mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
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:
parent
33d9157929
commit
da8b469ab8
5 changed files with 115 additions and 35 deletions
|
|
@ -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'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue