Permalink
Browse files

Add section path #2738 (#2746)

* PR for #2738 - add in a section path for controlling output location

fixes #2738
  • Loading branch information...
h4ckninja authored and Kwpolska committed May 8, 2017
1 parent 5b91084 commit 0c7709098fe9d057571086dfa67baf076847b09d
Showing with 12 additions and 1 deletion.
  1. +1 −0 AUTHORS.txt
  2. +2 −0 CHANGES.txt
  3. +6 −0 nikola/conf.py.in
  4. +2 −0 nikola/nikola.py
  5. +1 −1 nikola/plugins/task/sections.py
View
@@ -120,3 +120,4 @@
* `Yaşar Arabacı <https://github.com/yasar11732>`_
* `Zhaojun Meng <https://github.com/zhaojunmeng>`_
* `小明 <https://github.com/dongweiming>`_
+* `h4ckninja <https://github.com/h4ckninja>`_
View
@@ -13,6 +13,8 @@ Math support changes
Features
--------
+* Add ``SECTION_PATH`` support to move the section indexes to a
+ user-defined location (Issue #2738)
* Add a list of template variables to documentation (Issues #2328,
#2712, #2259) and update the theming reference (Issue #2259)
* Add ``{post_title}`` tag for Read More links (Issue #2709)
View
@@ -243,6 +243,12 @@ POSTS_SECTIONS = True
# are the default and will apply GENERATE_ATOM if set.
# POSTS_SECTIONS_ARE_INDEXES = True
+# Final locations are:
+# output / TRANSLATION[lang] / SECTION_PATH / SECTION_NAME / index.html (list of posts for a section)
+# output / TRANSLATION[lang] / SECTION_PATH / SECTION_NAME / rss.xml (RSS feed for a section)
+# (translatable)
+# SECTION_PATH = ""
+
# Each post and section page will have an associated color that can be used
# to style them with a recognizable color detail across your site. A color
# is assigned to each section based on shifting the hue of your THEME_COLOR
View
@@ -584,6 +584,7 @@ def __init__(self, **config):
'SOCIAL_BUTTONS_CODE': '',
'SITE_URL': 'https://example.com/',
'PAGE_INDEX': False,
+ 'SECTION_PATH': '',
'STRIP_INDEXES': False,
'SITEMAP_INCLUDE_FILELESS_DIRS': True,
'TAG_PATH': 'categories',
@@ -673,6 +674,7 @@ def __init__(self, **config):
'TAGS_INDEX_PATH',
'CATEGORY_PATH',
'CATEGORIES_INDEX_PATH',
+ 'SECTION_PATH',
'INDEX_PATH',
'RSS_PATH',
'AUTHOR_PATH',
@@ -98,7 +98,7 @@ def get_classification_friendly_name(self, section, lang, only_last_component=Fa
def get_path(self, section, lang, dest_type='page'):
"""Return a path for the given classification."""
- result = [_f for _f in [section] if _f]
+ result = [_f for _f in [self.site.config['SECTION_PATH'](lang), section] if _f]
if dest_type == 'rss':
return result + ['rss.xml'], 'never'
return result, 'always'

0 comments on commit 0c77090

Please sign in to comment.