mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
contents: Page.url_format should expose all metadata
I want to add `directory` metadata to each page in `content/pages/` to
place my non-article pages by hand:
PAGE_URL = '{directory}/{slug}'
PAGE_SAVE_AS = '{directory}/{slug}/index.html'
To do this, I need the `directory` metadata for formatting the URL.
This commit is contained in:
parent
be040715f9
commit
88b5a27ddf
1 changed files with 4 additions and 2 deletions
|
|
@ -114,14 +114,16 @@ class Page(object):
|
|||
|
||||
@property
|
||||
def url_format(self):
|
||||
return {
|
||||
metadata = copy.copy(self.metadata)
|
||||
metadata.update({
|
||||
'slug': getattr(self, 'slug', ''),
|
||||
'lang': getattr(self, 'lang', 'en'),
|
||||
'date': getattr(self, 'date', datetime.now()),
|
||||
'author': getattr(self, 'author', ''),
|
||||
'category': getattr(self, 'category',
|
||||
self.settings['DEFAULT_CATEGORY']),
|
||||
}
|
||||
})
|
||||
return metadata
|
||||
|
||||
def _expand_settings(self, key):
|
||||
fq_key = ('%s_%s' % (self.__class__.__name__, key)).upper()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue