mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix #21: Add a setting for the archive order (REVERSE_ARCHIVE_ORDER)
This commit is contained in:
parent
5748a91ad7
commit
3e9b80e993
3 changed files with 4 additions and 1 deletions
|
|
@ -50,6 +50,8 @@ Setting name what it does ?
|
||||||
(no rss)
|
(no rss)
|
||||||
`CSS_FILE` To specify the CSS file you want to load, if it's not
|
`CSS_FILE` To specify the CSS file you want to load, if it's not
|
||||||
the default one ('main.css')
|
the default one ('main.css')
|
||||||
|
`REVERSE_ARCHIVE_ORDER` Reverse the archives order. (True makes it in
|
||||||
|
descending order: the newer first)
|
||||||
======================= =======================================================
|
======================= =======================================================
|
||||||
|
|
||||||
Themes
|
Themes
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ class ArticlesGenerator(Generator):
|
||||||
# sort the articles by date
|
# sort the articles by date
|
||||||
self.articles.sort(key=attrgetter('date'), reverse=True)
|
self.articles.sort(key=attrgetter('date'), reverse=True)
|
||||||
self.dates = list(self.articles)
|
self.dates = list(self.articles)
|
||||||
self.dates.sort(key=attrgetter('date'))
|
self.dates.sort(key=attrgetter('date'), reverse=self.context['REVERSE_ARCHIVE_ORDER'])
|
||||||
# and generate the output :)
|
# and generate the output :)
|
||||||
self._update_context(('articles', 'dates', 'tags', 'categories'))
|
self._update_context(('articles', 'dates', 'tags', 'categories'))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ _DEFAULT_CONFIG = {'PATH': None,
|
||||||
'DEFAULT_CATEGORY': 'misc',
|
'DEFAULT_CATEGORY': 'misc',
|
||||||
'FALLBACK_ON_FS_DATE': True,
|
'FALLBACK_ON_FS_DATE': True,
|
||||||
'CSS_FILE': 'main.css',
|
'CSS_FILE': 'main.css',
|
||||||
|
'REVERSE_ARCHIVE_ORDER': False,
|
||||||
}
|
}
|
||||||
|
|
||||||
def read_settings(filename):
|
def read_settings(filename):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue