mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Addressed comments from @avaris in PR getpelican/pelican#1348
This commit is contained in:
parent
e86f4d6250
commit
b572cbeef1
2 changed files with 7 additions and 2 deletions
|
|
@ -70,7 +70,7 @@ DEFAULT_CONFIG = {
|
||||||
'DRAFT_LANG_SAVE_AS': os.path.join('drafts', '{slug}-{lang}.html'),
|
'DRAFT_LANG_SAVE_AS': os.path.join('drafts', '{slug}-{lang}.html'),
|
||||||
'PAGE_URL': 'pages/{slug}.html',
|
'PAGE_URL': 'pages/{slug}.html',
|
||||||
'PAGE_SAVE_AS': os.path.join('pages', '{slug}.html'),
|
'PAGE_SAVE_AS': os.path.join('pages', '{slug}.html'),
|
||||||
'PAGE_ORDER_BY': 'filename',
|
'PAGE_ORDER_BY': 'basename',
|
||||||
'PAGE_LANG_URL': 'pages/{slug}-{lang}.html',
|
'PAGE_LANG_URL': 'pages/{slug}-{lang}.html',
|
||||||
'PAGE_LANG_SAVE_AS': os.path.join('pages', '{slug}-{lang}.html'),
|
'PAGE_LANG_SAVE_AS': os.path.join('pages', '{slug}-{lang}.html'),
|
||||||
'STATIC_URL': '{path}',
|
'STATIC_URL': '{path}',
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,12 @@ def process_translations(content_list, order_by=None):
|
||||||
elif order_by == 'basename':
|
elif order_by == 'basename':
|
||||||
index.sort(key=lambda x: os.path.basename(x.source_path or ''))
|
index.sort(key=lambda x: os.path.basename(x.source_path or ''))
|
||||||
elif order_by != 'slug':
|
elif order_by != 'slug':
|
||||||
index.sort(key=attrgetter(order_by))
|
try:
|
||||||
|
index.sort(key=attrgetter(order_by))
|
||||||
|
except AttributeError:
|
||||||
|
error_msg = ('There is no "{}" attribute in the item metadata.'
|
||||||
|
'Defaulting to slug order.')
|
||||||
|
logger.warning(error_msg.format(order_by))
|
||||||
|
|
||||||
return index, translations
|
return index, translations
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue