Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added new setting CATEGORIES_INDEX_PATH (fixes #2567).
  • Loading branch information
felixfontein committed Dec 2, 2016
1 parent fee0925 commit c3d16dc
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -28,6 +28,8 @@ Features
create new taxonomies. Some of the existing taxonomies (authors,
archives, indexes, page index, sections, tags, and categories)
have been converted to the new system. (Issue #2107)
* Added ``CATEGORIES_INDEX_PATH``, similar to ``TAGS_INDEX_PATH``.
(Issue #2567)

New in v7.8.1
=============
Expand Down
5 changes: 5 additions & 0 deletions nikola/conf.py.in
Expand Up @@ -333,6 +333,11 @@ HIDDEN_TAGS = ['mathjax']
# CATEGORY_PATH = "categories"
# CATEGORY_PREFIX = "cat_"

# See CATEGORY_PATH's "list of categories" for the default setting value. Can be overwritten
# here any path relative to the output directory.
# (translatable)
# CATEGORIES_INDEX_PATH = "tags.html"

# If CATEGORY_ALLOW_HIERARCHIES is set to True, categories can be organized in
# hierarchies. For a post, the whole path in the hierarchy must be specified,
# using a forward slash ('/') to separate paths. Use a backslash ('\') to escape
Expand Down
2 changes: 2 additions & 0 deletions nikola/nikola.py
Expand Up @@ -439,6 +439,7 @@ def __init__(self, **config):
'BLOG_DESCRIPTION': 'Default Description',
'BODY_END': "",
'CACHE_FOLDER': 'cache',
'CATEGORIES_INDEX_PATH': '',
'CATEGORY_PATH': None, # None means: same as TAG_PATH
'CATEGORY_PAGES_ARE_INDEXES': None, # None means: same as TAG_PAGES_ARE_INDEXES
'CATEGORY_PAGES_DESCRIPTIONS': {},
Expand Down Expand Up @@ -647,6 +648,7 @@ def __init__(self, **config):
'TAG_PATH',
'TAGS_INDEX_PATH',
'CATEGORY_PATH',
'CATEGORIES_INDEX_PATH',
'DATE_FORMAT',
'JS_DATE_FORMAT',
)
Expand Down
5 changes: 4 additions & 1 deletion nikola/plugins/task/categories.py
Expand Up @@ -83,7 +83,10 @@ def get_classification_friendly_name(self, classification, lang, only_last_compo

def get_list_path(self, lang, type='page'):
"""A path handler for the list of all classifications."""
return [_f for _f in [self.site.config['CATEGORY_PATH'][lang]] if _f], 'always'
if self.site.config['CATEGORIES_INDEX_PATH'][lang]:
return [_f for _f in [self.site.config['CATEGORIES_INDEX_PATH'][lang]] if _f], 'never'
else:
return [_f for _f in [self.site.config['CATEGORY_PATH'][lang]] if _f], 'always'

def slugify_tag_name(self, name, lang):
"""Slugify a tag name."""
Expand Down

0 comments on commit c3d16dc

Please sign in to comment.