mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Support ordering pages and articles when iterating in templates.
Order can be set to a metadata attribute or a sorting function. Default to order by slug for articles and order by filename for pages.
This commit is contained in:
parent
3b0823f5e6
commit
0c69f4ad84
4 changed files with 43 additions and 3 deletions
|
|
@ -409,7 +409,8 @@ class ArticlesGenerator(Generator):
|
|||
(repr(article.status),
|
||||
repr(f)))
|
||||
|
||||
self.articles, self.translations = process_translations(all_articles)
|
||||
self.articles, self.translations = process_translations(all_articles,
|
||||
order_by=self.settings['ARTICLE_ORDER_BY'])
|
||||
|
||||
for article in self.articles:
|
||||
# only main articles are listed in categories and tags
|
||||
|
|
@ -517,7 +518,8 @@ class PagesGenerator(Generator):
|
|||
(repr(page.status),
|
||||
repr(f)))
|
||||
|
||||
self.pages, self.translations = process_translations(all_pages)
|
||||
self.pages, self.translations = process_translations(all_pages,
|
||||
order_by=self.settings['PAGE_ORDER_BY'])
|
||||
self.hidden_pages, self.hidden_translations = (
|
||||
process_translations(hidden_pages))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue