mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Add support for new article metadata modified date
Modified date is a standard feature in most blog engines. Theme developer can use this date to show last updated time of an article and enclose its value in `<time>` element. We cannot use mtime of a file for modified_date because it is already used for date metadata. Secondly, a file mtime can be affected in a lot many ways, for example, a sync service can change it, which will be incorrect to show as last updated time of an article.
This commit is contained in:
parent
455c159b48
commit
46d2b519fc
2 changed files with 3 additions and 0 deletions
|
|
@ -301,6 +301,7 @@ this metadata in text files via the following syntax (give your file the
|
||||||
##############
|
##############
|
||||||
|
|
||||||
:date: 2010-10-03 10:20
|
:date: 2010-10-03 10:20
|
||||||
|
:modified_date: 2011-01-10 16:56
|
||||||
:tags: thats, awesome
|
:tags: thats, awesome
|
||||||
:category: yeah
|
:category: yeah
|
||||||
:slug: my-super-post
|
:slug: my-super-post
|
||||||
|
|
@ -320,6 +321,7 @@ pattern::
|
||||||
|
|
||||||
Title: My super title
|
Title: My super title
|
||||||
Date: 2010-12-03 10:20
|
Date: 2010-12-03 10:20
|
||||||
|
Modified_date: 2011-01-10 16:56
|
||||||
Category: Python
|
Category: Python
|
||||||
Tags: pelican, publishing
|
Tags: pelican, publishing
|
||||||
Slug: my-super-post
|
Slug: my-super-post
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,7 @@ from pelican.utils import get_date, pelican_open
|
||||||
METADATA_PROCESSORS = {
|
METADATA_PROCESSORS = {
|
||||||
'tags': lambda x, y: [Tag(tag, y) for tag in x.split(',')],
|
'tags': lambda x, y: [Tag(tag, y) for tag in x.split(',')],
|
||||||
'date': lambda x, y: get_date(x),
|
'date': lambda x, y: get_date(x),
|
||||||
|
'modified_date': lambda x, y: get_date(x),
|
||||||
'status': lambda x, y: x.strip(),
|
'status': lambda x, y: x.strip(),
|
||||||
'category': Category,
|
'category': Category,
|
||||||
'author': Author,
|
'author': Author,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue