mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Added another option CLEAN_URLS, to use generated files with mod_rewrite and to show nice urls to the end user.
This commit is contained in:
parent
3afdb8fcff
commit
1d74de2559
3 changed files with 13 additions and 5 deletions
|
|
@ -31,11 +31,18 @@ class Page(object):
|
|||
if not hasattr(self, 'slug'):
|
||||
self.slug = slugify(self.title)
|
||||
|
||||
if not hasattr(self, 'url'):
|
||||
if not hasattr(self, 'save_as'):
|
||||
if self.in_default_lang:
|
||||
self.url = '%s.html' % self.slug
|
||||
self.save_as = '%s.html' % self.slug
|
||||
clean_url = '%s/' % self.slug
|
||||
else:
|
||||
self.url = '%s-%s.html' % (self.slug, self.lang)
|
||||
self.save_as = '%s-%s.html' % (self.slug, self.lang)
|
||||
clean_url = '%s-%s/' % (self.slug, self.lang)
|
||||
|
||||
if settings.get('CLEAN_URLS', False):
|
||||
self.url = clean_url
|
||||
else:
|
||||
self.url = self.save_as
|
||||
|
||||
if filename:
|
||||
self.filename = filename
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue