Fix for issue #219: tags should list only main articles, not translations

This commit is contained in:
Deniz Turgut 2013-03-26 01:28:42 -04:00
commit e6f3126ba6
7 changed files with 32 additions and 191 deletions

View file

@ -417,9 +417,6 @@ class ArticlesGenerator(Generator):
self.add_source_path(article)
if article.status == "published":
if hasattr(article, 'tags'):
for tag in article.tags:
self.tags[tag].append(article)
all_articles.append(article)
elif article.status == "draft":
self.drafts.append(article)
@ -431,12 +428,17 @@ class ArticlesGenerator(Generator):
self.articles, self.translations = process_translations(all_articles)
for article in self.articles:
# only main articles are listed in categories, not translations
# only main articles are listed in categories and tags
# not translations
self.categories[article.category].append(article)
if hasattr(article, 'tags'):
for tag in article.tags:
self.tags[tag].append(article)
# ignore blank authors as well as undefined
if hasattr(article, 'author') and article.author.name != '':
self.authors[article.author].append(article)
# sort the articles by date
self.articles.sort(key=attrgetter('date'), reverse=True)
self.dates = list(self.articles)