python-feedgen icon indicating copy to clipboard operation
python-feedgen copied to clipboard

Only href gets rendered for links

Open claeyswo opened this issue 1 year ago • 2 comments

https://github.com/lkiesow/python-feedgen/blob/97260abb1793eb164c458c10b493690beb413f6d/feedgen/entry.py#L139

Due to this commit https://github.com/lkiesow/python-feedgen/commit/966fea46ba4954f5511266e630697c4f06fb1221

This is our self.__atom_link object

image

But because in this line the link from the loop gets overwritten, all the subsequent gets do nothing.

Changing the code back to this, fixes our problem.

        for l in self.__atom_link or []:
            link = xml_elem('link', entry, href=l['href'])
            if l.get('rel'):
                link.attrib['rel'] = l['rel']
            if l.get('type'):
                link.attrib['type'] = l['type']
            if l.get('hreflang'):
                link.attrib['hreflang'] = l['hreflang']
            if l.get('title'):
                link.attrib['title'] = l['title']
            if l.get('length'):
                link.attrib['length'] = l['length']

claeyswo avatar Jan 18 '24 13:01 claeyswo

Recently ran into this issue as well, when using both FeedEntry.link and FeedEntry.enclosure in the same entry for embedding the link to my blog post and the cover image respectively caused the generated Atom XML string to fail W3C Atom 1.0 validation tests indicating that a single Atom entry cannot have two links with rel="alternate" simultaneously.

I've removed all images from my feed for the time being as a workaround, but would love to see it fixed so I may start including images again in my feed entries.

DonaldKellett avatar Feb 15 '24 13:02 DonaldKellett

I just stumbled upon this bug, no updates on the PR?

ldotlopez avatar May 10 '24 07:05 ldotlopez