Skip to content
Permalink
Browse files

Merge pull request #2385 from getnikola/fix-category-hierarchy-title

Fixes #2384.
  • Loading branch information
felixfontein committed Jun 29, 2016
2 parents 11e7772 + 569669b commit e525b32ff0990efb81536da6d44cebaa95da4dfa
Showing with 6 additions and 4 deletions.
  1. +2 −0 CHANGES.txt
  2. +4 −4 nikola/plugins/task/tags.py
@@ -11,6 +11,8 @@ Bugfixes

* Copy files when importing two-file posts instead of reading and
writing (useful for binary formats, eg. docx) (Issue #2380)
* Using correct category titles for category hierarchies
(Issue #2384)

New in v7.7.9
=============
@@ -253,9 +253,9 @@ def _get_title(self, tag, is_category):
else:
return tag

def _get_indexes_title(self, tag, is_category, lang, messages):
def _get_indexes_title(self, tag, nice_tag, is_category, lang, messages):
titles = self.site.config['CATEGORY_PAGES_TITLES'] if is_category else self.site.config['TAG_PAGES_TITLES']
return titles[lang][tag] if lang in titles and tag in titles[lang] else messages[lang]["Posts about %s"] % tag
return titles[lang][tag] if lang in titles and tag in titles[lang] else messages[lang]["Posts about %s"] % nice_tag

def _get_description(self, tag, is_category, lang):
descriptions = self.site.config['CATEGORY_PAGES_DESCRIPTIONS'] if is_category else self.site.config['TAG_PAGES_DESCRIPTIONS']
@@ -290,7 +290,7 @@ def page_path(i, displayed_i, num_pages, force_addition, extension=None):
context_source["category"] = tag
context_source["category_path"] = self.site.parse_category_name(tag)
context_source["tag"] = title
indexes_title = self._get_indexes_title(title, is_category, lang, kw["messages"])
indexes_title = self._get_indexes_title(tag, title, is_category, lang, kw["messages"])
context_source["description"] = self._get_description(tag, is_category, lang)
if is_category:
context_source["subcategories"] = self._get_subcategories(tag)
@@ -312,7 +312,7 @@ def tag_page_as_list(self, tag, lang, post_list, kw, is_category):
context["category"] = tag
context["category_path"] = self.site.parse_category_name(tag)
context["tag"] = title
context["title"] = self._get_indexes_title(title, is_category, lang, kw["messages"])
context["title"] = self._get_indexes_title(tag, title, is_category, lang, kw["messages"])
context["posts"] = post_list
context["permalink"] = self.site.link(kind, tag, lang)
context["kind"] = kind

0 comments on commit e525b32

Please sign in to comment.
You can’t perform that action at this time.