forked from varia/varia.website
many many many Varia's websites, work in progress: https://many.vvvvvvaria.org
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
579 B
21 lines
579 B
7 years ago
|
"""
|
||
|
If "modified" date/time is not defined in article metadata, fall back to the "created" date.
|
||
|
"""
|
||
|
|
||
|
from pelican import signals
|
||
|
from pelican.contents import Content, Article
|
||
|
|
||
|
def add_modified(content):
|
||
|
if not isinstance(content, Article):
|
||
|
return
|
||
|
|
||
|
if not content.settings.get('ALWAYS_MODIFIED', False):
|
||
|
return
|
||
|
|
||
|
if hasattr(content, 'date') and not hasattr(content, 'modified'):
|
||
|
content.modified = content.date
|
||
|
content.locale_modified = content.locale_date
|
||
|
|
||
|
def register():
|
||
|
signals.content_object_init.connect(add_modified)
|