Merge pull request #2051 from Totktonada/feature/rss_full_content_opt

Add option to include full content into RSS feeds
This commit is contained in:
Justin Mayer 2016-12-03 12:48:58 -08:00 committed by GitHub
commit f17f3068e3
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', ''),