Add option to include full content into RSS feeds

Include only summary by default.

This follow ups pull [1], where RSS feeds become summary-only.

[1]: https://github.com/getpelican/pelican/pull/1989
This commit is contained in:
Alexander Turenko 2016-11-16 02:18:46 +03:00
commit d3b22c6e21
3 changed files with 13 additions and 1 deletions

View file

@ -49,6 +49,7 @@ DEFAULT_CONFIG = {
'AUTHOR_FEED_RSS': posix_join('feeds', '%s.rss.xml'),
'TRANSLATION_FEED_ATOM': posix_join('feeds', 'all-%s.atom.xml'),
'FEED_MAX_ITEMS': '',
'RSS_FEED_SUMMARY_ONLY': True,
'SITEURL': '',
'SITENAME': 'A Pelican Blog',
'DISPLAY_PAGES_ON_MENU': True,

View file

@ -47,11 +47,16 @@ class Writer(object):
title = Markup(item.title).striptags()
link = '%s/%s' % (self.site_url, item.url)
is_rss = isinstance(feed, Rss201rev2Feed)
if not is_rss or self.settings.get('RSS_FEED_SUMMARY_ONLY'):
description = item.summary
else:
description = item.get_content(self.site_url)
feed.add_item(
title=title,
link=link,
unique_id=get_tag_uri(link, item.date),
description=item.summary,
description=description,
content=item.get_content(self.site_url),
categories=item.tags if hasattr(item, 'tags') else None,
author_name=getattr(item, 'author', ''),