mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Slugify is broken for non-ascii titles. Now slug could be redefined, using the metadata.
This commit is contained in:
parent
658e1203b2
commit
bc5a19a37b
1 changed files with 6 additions and 8 deletions
|
|
@ -20,6 +20,12 @@ class Page(object):
|
||||||
if 'AUTHOR' in settings:
|
if 'AUTHOR' in settings:
|
||||||
self.author = settings['AUTHOR']
|
self.author = settings['AUTHOR']
|
||||||
|
|
||||||
|
if not hasattr(self, 'slug'):
|
||||||
|
self.slug = slugify(self.title)
|
||||||
|
|
||||||
|
if not hasattr(self, 'url'):
|
||||||
|
self.url = '%s.html' % self.slug
|
||||||
|
|
||||||
if filename:
|
if filename:
|
||||||
self.filename = filename
|
self.filename = filename
|
||||||
|
|
||||||
|
|
@ -29,14 +35,6 @@ class Page(object):
|
||||||
if not hasattr(self, prop):
|
if not hasattr(self, prop):
|
||||||
raise NameError(prop)
|
raise NameError(prop)
|
||||||
|
|
||||||
@property
|
|
||||||
def url(self):
|
|
||||||
return '%s.html' % self.slug
|
|
||||||
|
|
||||||
@property
|
|
||||||
def slug(self):
|
|
||||||
return slugify(self.title)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def summary(self):
|
def summary(self):
|
||||||
return truncate_html_words(self.content, 50)
|
return truncate_html_words(self.content, 50)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue