lkiesow / python-feedgen

Python module to generate ATOM feeds, RSS feeds and Podcasts.
https://feedgen.kiesow.be/
BSD 2-Clause "Simplified" License
709 stars 123 forks source link

Only href gets rendered for links #135

Open claeyswo opened 5 months ago

claeyswo commented 5 months ago

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']
DonaldKellett commented 4 months ago

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.

ldotlopez commented 2 months ago

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