Skip to content

Commit

Permalink
Fix PAGE_INDEX conflict avoiding (don’t drop index.html)
Browse files Browse the repository at this point in the history
cc @felixfontein

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Mar 26, 2017
1 parent ad6b25a commit 3ad3af0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions nikola/plugins/task/page_index.py
Expand Up @@ -64,9 +64,6 @@ def is_enabled(self, lang=None):
def classify(self, post, lang):
"""Classify the given post for the given language."""
destpath = post.destination_path(lang, sep='/')
index_len = len(self.site.config["INDEX_FILE"])
if destpath[-(1 + index_len):] == '/' + self.site.config["INDEX_FILE"]:
destpath = destpath[:-(1 + index_len)]
i = destpath.rfind('/')
return [destpath[:i] if i >= 0 else '']

Expand Down Expand Up @@ -102,8 +99,12 @@ def provide_context_and_uptodate(self, dirname, lang, node=None):
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']
print('-S', short_destination)
print('-D', dirname)
print('-P', post_list)
for post in post_list:
# If there is an index.html pending to be created from a page, do not generate the page index.
print(post.destination_path(lang, sep='/'))
if post.destination_path(lang, sep='/') == short_destination:
return False
return True

0 comments on commit 3ad3af0

Please sign in to comment.