mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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:
commit
f17f3068e3
3 changed files with 13 additions and 1 deletions
|
|
@ -841,6 +841,12 @@ the ``TAG_FEED_ATOM`` and ``TAG_FEED_RSS`` settings:
|
||||||
Maximum number of items allowed in a feed. Feed item quantity is
|
Maximum number of items allowed in a feed. Feed item quantity is
|
||||||
unrestricted by default.
|
unrestricted by default.
|
||||||
|
|
||||||
|
.. data:: RSS_FEED_SUMMARY_ONLY = True
|
||||||
|
|
||||||
|
Only include item summaries in the ``description`` tag of RSS feeds. If set
|
||||||
|
to ``False``, the full content will be included instead. This setting
|
||||||
|
doesn't affect Atom feeds, only RSS ones.
|
||||||
|
|
||||||
If you don't want to generate some or any of these feeds, set the above variables to ``None``.
|
If you don't want to generate some or any of these feeds, set the above variables to ``None``.
|
||||||
|
|
||||||
.. [2] %s is the name of the category.
|
.. [2] %s is the name of the category.
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ DEFAULT_CONFIG = {
|
||||||
'AUTHOR_FEED_RSS': posix_join('feeds', '%s.rss.xml'),
|
'AUTHOR_FEED_RSS': posix_join('feeds', '%s.rss.xml'),
|
||||||
'TRANSLATION_FEED_ATOM': posix_join('feeds', 'all-%s.atom.xml'),
|
'TRANSLATION_FEED_ATOM': posix_join('feeds', 'all-%s.atom.xml'),
|
||||||
'FEED_MAX_ITEMS': '',
|
'FEED_MAX_ITEMS': '',
|
||||||
|
'RSS_FEED_SUMMARY_ONLY': True,
|
||||||
'SITEURL': '',
|
'SITEURL': '',
|
||||||
'SITENAME': 'A Pelican Blog',
|
'SITENAME': 'A Pelican Blog',
|
||||||
'DISPLAY_PAGES_ON_MENU': True,
|
'DISPLAY_PAGES_ON_MENU': True,
|
||||||
|
|
|
||||||
|
|
@ -47,11 +47,16 @@ class Writer(object):
|
||||||
|
|
||||||
title = Markup(item.title).striptags()
|
title = Markup(item.title).striptags()
|
||||||
link = '%s/%s' % (self.site_url, item.url)
|
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(
|
feed.add_item(
|
||||||
title=title,
|
title=title,
|
||||||
link=link,
|
link=link,
|
||||||
unique_id=get_tag_uri(link, item.date),
|
unique_id=get_tag_uri(link, item.date),
|
||||||
description=item.summary,
|
description=description,
|
||||||
content=item.get_content(self.site_url),
|
content=item.get_content(self.site_url),
|
||||||
categories=item.tags if hasattr(item, 'tags') else None,
|
categories=item.tags if hasattr(item, 'tags') else None,
|
||||||
author_name=getattr(item, 'author', ''),
|
author_name=getattr(item, 'author', ''),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue