mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Allow definition of pagination rules by page index.
This commit is contained in:
parent
71e83635ea
commit
95890a2a61
2 changed files with 31 additions and 4 deletions
|
|
@ -73,8 +73,9 @@ DEFAULT_CONFIG = {
|
|||
'TAG_SAVE_AS': os.path.join('tag', '{slug}.html'),
|
||||
'AUTHOR_URL': 'author/{slug}.html',
|
||||
'AUTHOR_SAVE_AS': os.path.join('author', '{slug}.html'),
|
||||
'PAGINATION_URL': '{name}{number}.html',
|
||||
'PAGINATION_SAVE_AS': '{name}{number}.html',
|
||||
'PAGINATION_PATTERNS': [
|
||||
(0, '{name}{number}.html', '{name}{number}.html'),
|
||||
],
|
||||
'YEAR_ARCHIVE_SAVE_AS': False,
|
||||
'MONTH_ARCHIVE_SAVE_AS': False,
|
||||
'DAY_ARCHIVE_SAVE_AS': False,
|
||||
|
|
@ -238,6 +239,16 @@ def configure_settings(settings):
|
|||
'http://docs.getpelican.com/en/latest/settings.html#timezone '
|
||||
'for more information')
|
||||
|
||||
# fix up pagination rules
|
||||
from pelican.paginator import PaginationRule
|
||||
pagination_rules = [
|
||||
PaginationRule(*r) for r in settings['PAGINATION_PATTERNS']
|
||||
]
|
||||
settings['PAGINATION_PATTERNS'] = sorted(
|
||||
pagination_rules,
|
||||
key=lambda r: r[0],
|
||||
)
|
||||
|
||||
# Save people from accidentally setting a string rather than a list
|
||||
path_keys = (
|
||||
'ARTICLE_EXCLUDES',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue