Skip to content

Commit

Permalink
Work around conflicts between posts and section indexes (via #2613)
Browse files Browse the repository at this point in the history
This is a workaround, because it uses the same mechanism `PAGE_INDEXES`
use to prevent generating pages. A real solution would need to figure
out that those pages are not sections.
  • Loading branch information
Kwpolska committed Jan 7, 2017
1 parent 5838a4d commit 4247702
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ New in master
Bugfixes
--------

* Work around conflicts between posts and sections trying to render
index.html files (via Issue #2613)
* Make ``AUTHOR_PAGES_ARE_INDEXES`` really work (Issue #2600)
* WordPress importer now correctly handles & etc. in tags.
(Issue #2557)
Expand Down
10 changes: 10 additions & 0 deletions nikola/plugins/task/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,13 @@ def postprocess_posts_per_classification(self, posts_per_section_per_language, f
continue
sections.add(section)
self.enable_for_lang[lang] = (len(sections) > 1)

def should_generate_classification_page(self, dirname, post_list, lang):
"""Only generates list of posts for classification if this function returns True."""
short_destination = dirname + '/' + self.site.config['INDEX_FILE']
for post in post_list:
# If there is an index.html pending to be created from a page, do not generate the section page.
# The section page would be useless anyways. (via Issue #2613)
if post.destination_path(lang, sep='/') == short_destination:
return False
return True

0 comments on commit 4247702

Please sign in to comment.