forked from github/pelican
Add the EXTRA_PATH_METADATA setting
Useful for altering static output paths when you don't want to encode extra metadata in the static file's source path.
This commit is contained in:
parent
1ca0e06a27
commit
d43dc1b9d6
3 changed files with 8 additions and 3 deletions
|
|
@ -413,9 +413,12 @@ def default_metadata(settings=None, process=None):
|
|||
|
||||
def path_metadata(full_path, source_path, settings=None):
|
||||
metadata = {}
|
||||
if settings and settings.get('DEFAULT_DATE', None) == 'fs':
|
||||
metadata['date'] = datetime.datetime.fromtimestamp(
|
||||
os.stat(path).st_ctime)
|
||||
if settings:
|
||||
if settings.get('DEFAULT_DATE', None) == 'fs':
|
||||
metadata['date'] = datetime.datetime.fromtimestamp(
|
||||
os.stat(full_path).st_ctime)
|
||||
metadata.update(settings.get('EXTRA_PATH_METADATA', {}).get(
|
||||
source_path, {}))
|
||||
return metadata
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue