mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
I developed the ARTICLE_PERMALINK_STRUCTURE option into the wrong method, because urls in feed are not being modified. Now, it's fixed. Issue #145.
This commit is contained in:
parent
a9bb789b14
commit
319b553f69
1 changed files with 15 additions and 14 deletions
|
|
@ -161,20 +161,6 @@ class ArticlesGenerator(Generator):
|
||||||
# in writer, articles pass first
|
# in writer, articles pass first
|
||||||
article_template = self.get_template('article')
|
article_template = self.get_template('article')
|
||||||
for article in chain(self.translations, self.articles):
|
for article in chain(self.translations, self.articles):
|
||||||
add_to_url = u''
|
|
||||||
if 'ARTICLE_PERMALINK_STRUCTURE' in self.settings:
|
|
||||||
article_permalink_structure = self.settings['ARTICLE_PERMALINK_STRUCTURE']
|
|
||||||
article_permalink_structure = article_permalink_structure.lstrip('/')
|
|
||||||
|
|
||||||
# try to substitute any python datetime directive
|
|
||||||
add_to_url = article.date.strftime(article_permalink_structure)
|
|
||||||
# try to substitute any article metadata in rest file
|
|
||||||
add_to_url = add_to_url % article.__dict__
|
|
||||||
add_to_url = [slugify(i) for i in add_to_url.split('/')]
|
|
||||||
add_to_url = os.path.join(*add_to_url)
|
|
||||||
|
|
||||||
article.url = urlparse.urljoin(add_to_url, article.url)
|
|
||||||
article.save_as = urlparse.urljoin(add_to_url, article.save_as)
|
|
||||||
write(article.save_as,
|
write(article.save_as,
|
||||||
article_template, self.context, article=article,
|
article_template, self.context, article=article,
|
||||||
category=article.category)
|
category=article.category)
|
||||||
|
|
@ -247,6 +233,21 @@ class ArticlesGenerator(Generator):
|
||||||
if not is_valid_content(article, f):
|
if not is_valid_content(article, f):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
add_to_url = u''
|
||||||
|
if 'ARTICLE_PERMALINK_STRUCTURE' in self.settings:
|
||||||
|
article_permalink_structure = self.settings['ARTICLE_PERMALINK_STRUCTURE']
|
||||||
|
article_permalink_structure = article_permalink_structure.lstrip('/')
|
||||||
|
|
||||||
|
# try to substitute any python datetime directive
|
||||||
|
add_to_url = article.date.strftime(article_permalink_structure)
|
||||||
|
# try to substitute any article metadata in rest file
|
||||||
|
add_to_url = add_to_url % article.__dict__
|
||||||
|
add_to_url = [slugify(i) for i in add_to_url.split('/')]
|
||||||
|
add_to_url = os.path.join(*add_to_url)
|
||||||
|
|
||||||
|
article.url = urlparse.urljoin(add_to_url, article.url)
|
||||||
|
article.save_as = urlparse.urljoin(add_to_url, article.save_as)
|
||||||
|
|
||||||
if article.status == "published":
|
if article.status == "published":
|
||||||
if hasattr(article, 'tags'):
|
if hasattr(article, 'tags'):
|
||||||
for tag in article.tags:
|
for tag in article.tags:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue