Add feature to add rel param to rss feedss if requested

This commit is contained in:
Gio 2023-11-21 18:11:11 -06:00
commit 25c84cc1b3
3 changed files with 9 additions and 0 deletions

View file

@ -1008,6 +1008,11 @@ the ``TAG_FEED_ATOM`` and ``TAG_FEED_RSS`` settings:
to ``False``, the full content will be included instead. This setting
doesn't affect Atom feeds, only RSS ones.
.. data:: FEED_APPEND_REL = False
If set to ``True``, ``?rel=rss`` will be appended to links in generated
feeds for the purpose of referrer tracking.
If you don't want to generate some or any of these feeds, set the above
variables to ``None``.

View file

@ -48,6 +48,7 @@ DEFAULT_CONFIG = {
"TRANSLATION_FEED_ATOM": "feeds/all-{lang}.atom.xml",
"FEED_MAX_ITEMS": 100,
"RSS_FEED_SUMMARY_ONLY": True,
"FEED_APPEND_REL": False,
"SITEURL": "",
"SITENAME": "A Pelican Blog",
"DISPLAY_PAGES_ON_MENU": True,

View file

@ -53,6 +53,9 @@ class Writer:
title = Markup(item.title).striptags()
link = self.urljoiner(self.site_url, item.url)
if self.settings["FEED_APPEND_REL"]:
link = link + "?rel=rss"
if isinstance(feed, Rss201rev2Feed):
# RSS feeds use a single tag called 'description' for both the full
# content and the summary