Fix #1647: Fix ARTICLE_ORDER_BY and add the ability to reverse order

ARTICLE_ORDER_BY wasn't doing anything because the ArticlesGenerator
was sorting articles after ARTICLE_ORDER_BY was applied. This fixes
that by adding the ability to reverse metadata order by adding the
option prefix 'reversed-' to metadata and changing the default value
to 'reversed-date'.

Relevant documentation is also updated and moved into a more appropriate
place ('Ordering Content' instead of 'URL settings').
This commit is contained in:
Deniz Turgut 2015-06-12 17:15:19 -04:00
commit da8b469ab8
5 changed files with 115 additions and 35 deletions

View file

@ -561,8 +561,7 @@ class ArticlesGenerator(CachingGenerator):
self.tags[tag].append(article)
for author in getattr(article, 'authors', []):
self.authors[author].append(article)
# sort the articles by date
self.articles.sort(key=attrgetter('date'), reverse=True)
self.dates = list(self.articles)
self.dates.sort(key=attrgetter('date'),
reverse=self.context['NEWEST_FIRST_ARCHIVES'])