Skip to content

Commit

Permalink
Merge pull request #51 from Bastian-Krause/bst/feed-summary
Browse files Browse the repository at this point in the history
plugins/feeds: mention summary plugin, render summaries correctly
  • Loading branch information
SmithChart authored Aug 19, 2024
2 parents 087f4d8 + a474abd commit d51d5f2
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion flamingo/plugins/feeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ def make_urls_absolute(html, base_url):

class Feeds:
def pre_build(self, context):
env = context.templating_engine.env
render_summary = env.globals.get('render_summary')
FEEDS_DOMAIN = getattr(context.settings, 'FEEDS_DOMAIN', '/')
FEEDS = getattr(context.settings, 'FEEDS', [])

Expand Down Expand Up @@ -165,8 +167,17 @@ def pre_build(self, context):
'name': author,
})

# relies on a plugin generating a summary - see
# https://github.com/pengutronix/flamingo-ptx-blog-engine/blob/master/flamingo_ptx_blog_engine/summary.py
# for an example
if i['summary']:
summary = str(i['summary'])
if render_summary:
summary = render_summary(i)
else:
summary = str(i['summary'])

summary = make_urls_absolute(summary, fe_link['href'])

if 'html_filter' in feed_config:
summary = feed_config['html_filter'](summary)
fe.summary(summary, type='html')
Expand Down

0 comments on commit d51d5f2

Please sign in to comment.