mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
do slug_substitutions on category and author ...
This commit is contained in:
parent
9f0ad2bd95
commit
6c5444eb68
1 changed files with 10 additions and 3 deletions
|
|
@ -141,14 +141,21 @@ class Content(object):
|
||||||
"""Returns the URL, formatted with the proper values"""
|
"""Returns the URL, formatted with the proper values"""
|
||||||
metadata = copy.copy(self.metadata)
|
metadata = copy.copy(self.metadata)
|
||||||
path = self.metadata.get('path', self.get_relative_source_path())
|
path = self.metadata.get('path', self.get_relative_source_path())
|
||||||
|
default_category = self.settings['DEFAULT_CATEGORY']
|
||||||
|
slug_substitutions = self.settings.get('SLUG_SUBSTITUTIONS', ())
|
||||||
metadata.update({
|
metadata.update({
|
||||||
'path': path_to_url(path),
|
'path': path_to_url(path),
|
||||||
'slug': getattr(self, 'slug', ''),
|
'slug': getattr(self, 'slug', ''),
|
||||||
'lang': getattr(self, 'lang', 'en'),
|
'lang': getattr(self, 'lang', 'en'),
|
||||||
'date': getattr(self, 'date', datetime.now()),
|
'date': getattr(self, 'date', datetime.now()),
|
||||||
'author': getattr(self, 'author', ''),
|
'author': slugify(
|
||||||
'category': getattr(self, 'category',
|
getattr(self, 'author', ''),
|
||||||
self.settings['DEFAULT_CATEGORY']),
|
slug_substitutions
|
||||||
|
),
|
||||||
|
'category': slugify(
|
||||||
|
getattr(self, 'category', default_category),
|
||||||
|
slug_substitutions
|
||||||
|
)
|
||||||
})
|
})
|
||||||
return metadata
|
return metadata
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue