Skip to content
Permalink
Browse files
Merge pull request #3026 from getnikola/fix-3022-better-index-html-co…
…nflict-errors

Fix #3022 -- Explain index.html conflicts better
  • Loading branch information
Kwpolska committed Apr 15, 2018
2 parents 0e8c7a6 + a9be3c7 commit c5b7b96c687676bcf5cf9f624550a524cc8af30c
Showing with 17 additions and 1 deletion.
  1. +1 −0 CHANGES.txt
  2. +16 −1 nikola/plugins/task/pages.py
@@ -5,6 +5,7 @@ Features
--------

* Add support for fragments in path handlers (Issue #3032)
* Explain index.html conflicts better (Issue #3022)
* Recognize both TEASER_END and (new) END_TEASER (Issue #3010)
* New MARKDOWN_EXTENSION_CONFIGS setting (Issue #2970)
* Replace ``flowr.js`` with ``justified-layout.js`` by Flickr
@@ -26,8 +26,10 @@

"""Render pages into output."""

import os

from nikola.plugin_categories import Task
from nikola.utils import config_changed
from nikola.utils import config_changed, LOGGER


class RenderPages(Task):
@@ -46,6 +48,13 @@ def gen_tasks(self):
}
self.site.scan_posts()
yield self.group_task()
index_paths = {}
for lang in kw["translations"]:
index_paths[lang] = False
if not self.site.config["DISABLE_INDEXES_PLUGIN_INDEX_AND_ATOM_FEED"]:
index_paths[lang] = os.path.normpath(os.path.join(self.site.config['OUTPUT_FOLDER'],
self.site.path('index', '', lang=lang)))

for lang in kw["translations"]:
for post in self.site.timeline:
if not kw["show_untranslated_posts"] and not post.is_translation_available(lang):
@@ -55,6 +64,12 @@ def gen_tasks(self):
else:
context = {'pagekind': ['story_page', 'page_page']}
for task in self.site.generic_page_renderer(lang, post, kw["filters"], context):
if task['name'] == index_paths[lang]:
# Issue 3022
LOGGER.error(
"Post {0!r}: output path ({1}) conflicts with the blog index ({2}). "
"Please change INDEX_PATH or disable index generation.".format(
post.source_path, task['name'], index_paths[lang]))
task['uptodate'] = task['uptodate'] + [config_changed(kw, 'nikola.plugins.task.pages')]
task['basename'] = self.name
task['task_dep'] = ['render_posts']

0 comments on commit c5b7b96

Please sign in to comment.