Skip to content

Commit

Permalink
Add media:thumbnail for atom feed entries
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromechoo committed Sep 23, 2024
1 parent 7b251f8 commit 7b95ee3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def generate_feed(url):

# 2. Instantiate a Feed
fg = FeedGenerator()
fg.load_extension('media')
fg.title(feed_title if feed_title else feed_url)
fg.id(feed_url)
fg.description(feed_description)
Expand All @@ -120,6 +121,7 @@ def generate_feed(url):
fe.link(href=article.get("link", ""))
if image := article.get("image", None):
fe.enclosure(url=image, length=0, type='image/jpeg')
fe.media.thumbnail(url=image)
fe.description(article.get("summary", ""))
if author := article.get("byline", None) or article.get("author", None):
fe.author(name=author)
Expand Down

0 comments on commit 7b95ee3

Please sign in to comment.