From fc4b3e44d8a92635cabcff57bdf078cb2385ad80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Oct 2017 20:31:09 +0100 Subject: [PATCH 1/2] Make use of SITESUBTITLE setting also in Atom feeds. For some reason, feedgenerator.py uses the `description` argument only for RSS and the `subtitle` argument only for Atom. So setting both to the same value. In order to avoid unnecessary changes, if SITESUBTITLE is not present, the subtitle is set to None instead of '', so the generated Atom feed doesn't contain an empty tag (in contrast, the RSS feed contains an empty tag now, though). --- pelican/writers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pelican/writers.py b/pelican/writers.py index fef0d5ca..ff3207fa 100644 --- a/pelican/writers.py +++ b/pelican/writers.py @@ -40,7 +40,8 @@ class Writer(object): title=Markup(feed_title).striptags(), link=(self.site_url + '/'), feed_url=self.feed_url, - description=context.get('SITESUBTITLE', '')) + description=context.get('SITESUBTITLE', ''), + subtitle=context.get('SITESUBTITLE', None)) return feed def _add_item_to_the_feed(self, feed, item): From d04b777159a7a28238a5bb989bbae1bce1a9c6b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 29 Oct 2017 21:28:11 +0100 Subject: [PATCH 2/2] Test for SITESUBTITLE in feeds. It's now present in both RSS and Atom feeds. --- pelican/tests/output/custom/a-markdown-powered-article.html | 2 +- pelican/tests/output/custom/archives.html | 2 +- pelican/tests/output/custom/article-1.html | 2 +- pelican/tests/output/custom/article-2.html | 2 +- pelican/tests/output/custom/article-3.html | 2 +- pelican/tests/output/custom/author/alexis-metaireau.html | 2 +- pelican/tests/output/custom/author/alexis-metaireau2.html | 2 +- pelican/tests/output/custom/author/alexis-metaireau3.html | 2 +- pelican/tests/output/custom/authors.html | 2 +- pelican/tests/output/custom/categories.html | 2 +- pelican/tests/output/custom/category/bar.html | 2 +- pelican/tests/output/custom/category/cat1.html | 2 +- pelican/tests/output/custom/category/misc.html | 2 +- pelican/tests/output/custom/category/yeah.html | 2 +- pelican/tests/output/custom/drafts/a-draft-article.html | 2 +- pelican/tests/output/custom/feeds/alexis-metaireau.atom.xml | 2 +- pelican/tests/output/custom/feeds/alexis-metaireau.rss.xml | 2 +- pelican/tests/output/custom/feeds/all-en.atom.xml | 2 +- pelican/tests/output/custom/feeds/all-fr.atom.xml | 2 +- pelican/tests/output/custom/feeds/all.atom.xml | 2 +- pelican/tests/output/custom/feeds/all.rss.xml | 2 +- pelican/tests/output/custom/feeds/bar.atom.xml | 2 +- pelican/tests/output/custom/feeds/bar.rss.xml | 2 +- pelican/tests/output/custom/feeds/cat1.atom.xml | 2 +- pelican/tests/output/custom/feeds/cat1.rss.xml | 2 +- pelican/tests/output/custom/feeds/misc.atom.xml | 2 +- pelican/tests/output/custom/feeds/misc.rss.xml | 2 +- pelican/tests/output/custom/feeds/yeah.atom.xml | 2 +- pelican/tests/output/custom/feeds/yeah.rss.xml | 2 +- pelican/tests/output/custom/filename_metadata-example.html | 2 +- pelican/tests/output/custom/index.html | 2 +- pelican/tests/output/custom/index2.html | 2 +- pelican/tests/output/custom/index3.html | 2 +- pelican/tests/output/custom/jinja2_template.html | 2 +- pelican/tests/output/custom/oh-yeah-fr.html | 2 +- pelican/tests/output/custom/oh-yeah.html | 2 +- pelican/tests/output/custom/override/index.html | 2 +- .../tests/output/custom/pages/this-is-a-test-hidden-page.html | 2 +- pelican/tests/output/custom/pages/this-is-a-test-page.html | 2 +- pelican/tests/output/custom/second-article-fr.html | 2 +- pelican/tests/output/custom/second-article.html | 2 +- pelican/tests/output/custom/tag/bar.html | 2 +- pelican/tests/output/custom/tag/baz.html | 2 +- pelican/tests/output/custom/tag/foo.html | 2 +- pelican/tests/output/custom/tag/foobar.html | 2 +- pelican/tests/output/custom/tag/oh.html | 2 +- pelican/tests/output/custom/tag/yeah.html | 2 +- pelican/tests/output/custom/tags.html | 2 +- pelican/tests/output/custom/this-is-a-super-article.html | 2 +- pelican/tests/output/custom/unbelievable.html | 2 +- samples/pelican.conf.py | 1 + 51 files changed, 51 insertions(+), 50 deletions(-) diff --git a/pelican/tests/output/custom/a-markdown-powered-article.html b/pelican/tests/output/custom/a-markdown-powered-article.html index 86c6a98d..5c416f2f 100644 --- a/pelican/tests/output/custom/a-markdown-powered-article.html +++ b/pelican/tests/output/custom/a-markdown-powered-article.html @@ -13,7 +13,7 @@ Fork me on GitHub