diff --git a/pelican/generators.py b/pelican/generators.py index 8d6de666..f6ac35a0 100755 --- a/pelican/generators.py +++ b/pelican/generators.py @@ -161,20 +161,6 @@ class ArticlesGenerator(Generator): # in writer, articles pass first article_template = self.get_template('article') 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, article_template, self.context, article=article, category=article.category) @@ -247,6 +233,21 @@ class ArticlesGenerator(Generator): if not is_valid_content(article, f): 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 hasattr(article, 'tags'): for tag in article.tags: diff --git a/pelican/themes/notmyidea/templates/comments.html b/pelican/themes/notmyidea/templates/comments.html index ea693afb..bb033c0f 100644 --- a/pelican/themes/notmyidea/templates/comments.html +++ b/pelican/themes/notmyidea/templates/comments.html @@ -1 +1 @@ -{% if DISQUS_SITENAME %}

There are comments.

{% endif %} +{% if DISQUS_SITENAME %}

There are comments.

{% endif %} diff --git a/pelican/themes/simple/templates/article.html b/pelican/themes/simple/templates/article.html index 0bfed07a..30d31fb6 100644 --- a/pelican/themes/simple/templates/article.html +++ b/pelican/themes/simple/templates/article.html @@ -1,7 +1,7 @@ {% extends "base.html" %} {% block content %}
-

{{ article.title }}

+

{{ article.title }}