1
0
Fork 0
forked from github/pelican

Reverted FEED_ATOM and FEED_RSS to their original behaviour and added FEED_ALL_ATOM and FEED_ALL_RSS

FEED_(ATOM|RSS) generated feeds include the version in the default language of a translated article,
whereas FEED_ALL(ATOM|RSS) would include *really* all posts, regardless of their language.
This commit is contained in:
jawher 2012-10-22 23:37:52 +02:00 committed by Bruno Binet
commit c7d87feec3
4 changed files with 30 additions and 17 deletions

View file

@ -64,6 +64,12 @@ FEED_ATOM :
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);

View file

@ -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.

View file

@ -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

View file

@ -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'):