diff --git a/docs/fr/configuration.rst b/docs/fr/configuration.rst index 76f03a61..e3fb8542 100644 --- a/docs/fr/configuration.rst +++ b/docs/fr/configuration.rst @@ -59,11 +59,17 @@ CATEGORY_FEED_RSS : Idem pour les flux rss (Optionnel); FEED_ATOM : - Chemin du flux Atom global ; + Chemin du flux Atom global; FEED_RSS : Chemin du flux Rss global (Optionnel); +FEED_ALL_ATOM : + Chemin du flux Atom global qui inclut la totalité des posts, indépendamment de la langue; + +FEED_ALL_RSS : + Chemin du flux Rss global qui inclut la totalité des posts, indépendamment de la langue (Optionnel); + TAG_FEED_ATOM : Chemin des flux Atom pour les tags (Optionnel); diff --git a/docs/settings.rst b/docs/settings.rst index 6bcc7292..eeca4c3a 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -306,6 +306,8 @@ Setting name (default value) What does it do? feeds, you can just set: `FEED_DOMAIN = SITEURL` `FEED_ATOM` (``'feeds/all.atom.xml'``) Relative URL to output the Atom feed. `FEED_RSS` (``None``, i.e. no RSS) Relative URL to output the RSS feed. +`FEED_ALL_ATOM` (``None``, i.e. no all feed) Relative URL to output the all posts Atom feed. +`FEED_ALL_RSS` (``None``, i.e. no all RSS) Relative URL to output the all posts RSS feed. `CATEGORY_FEED_ATOM` ('feeds/%s.atom.xml'[2]_) Where to put the category Atom feeds. `CATEGORY_FEED_RSS` (``None``, i.e. no RSS) Where to put the category RSS feeds. `TAG_FEED_ATOM` (``None``, i.e. no tag feed) Relative URL to output the tag Atom feed. It should @@ -315,9 +317,8 @@ Setting name (default value) What does it do? quantity is unrestricted by default. ================================================ ===================================================== -If you don't want to generate some of these feeds, set ``None`` to the -variables above. If you don't want to generate any feeds set both ``FEED_ATOM`` -and ``FEED_RSS`` to none. +If you don't want to generate some or any of these feeds, set ``None`` to the +variables above. .. [2] %s is the name of the category. diff --git a/docs/themes.rst b/docs/themes.rst index e482bc9b..664b4466 100644 --- a/docs/themes.rst +++ b/docs/themes.rst @@ -200,6 +200,8 @@ Here is a complete list of the feed variables:: FEED_ATOM FEED_RSS + FEED_ALL_ATOM + FEED_ALL_RSS CATEGORY_FEED_ATOM CATEGORY_FEED_RSS TAG_FEED_ATOM diff --git a/pelican/generators.py b/pelican/generators.py index 966bd36c..33316a94 100644 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -156,29 +156,33 @@ class ArticlesGenerator(Generator): def generate_feeds(self, writer): """Generate the feeds from the current context, and output files.""" - if self.settings.get('FEED_ATOM') is None \ - and self.settings.get('FEED_RSS') is None: - return - elif self.settings.get('SITEURL') is '': + if self.settings.get('SITEURL') is '': logger.warning( 'Feeds generated without SITEURL set properly may not be valid' ) - all_articles = list(self.articles) - - for article in self.articles: - all_articles.extend(article.translations) - - all_articles.sort(key=attrgetter('date'), reverse=True) - if self.settings.get('FEED_ATOM'): - writer.write_feed(all_articles, self.context, + writer.write_feed(self.articles, self.context, self.settings['FEED_ATOM']) if self.settings.get('FEED_RSS'): - writer.write_feed(all_articles, self.context, + writer.write_feed(self.articles, self.context, self.settings['FEED_RSS'], feed_type='rss') + if self.settings.get('FEED_ALL_ATOM') or self.settings.get('FEED_ALL_RSS'): + all_articles = list(self.articles) + for article in self.articles: + all_articles.extend(article.translations) + all_articles.sort(key=attrgetter('date'), reverse=True) + + if self.settings.get('FEED_ALL_ATOM'): + writer.write_feed(all_articles, self.context, + self.settings['FEED_ALL_ATOM']) + + if self.settings.get('FEED_ALL_RSS'): + writer.write_feed(all_articles, self.context, + self.settings['FEED_ALL_RSS'], feed_type='rss') + for cat, arts in self.categories: arts.sort(key=attrgetter('date'), reverse=True) if self.settings.get('CATEGORY_FEED_ATOM'):