Repository: getnikola/nikola

Issue:
render_taxonomies:index.html conflicts with pages/index.html
### Environment (if reporting a bug)

**Python Version:** 3.5.3

**Nikola Version:** v7.8.14

**Operating System:** Debian

### Description:

I get the following error:

```
ERROR: Two different tasks can't have a common target.'output/index.html' is a target for render_taxonomies:output/index.html and render_pages:output/index.html.
```

My config has

```
PAGES = (
    ("pages/*.md", "", "page.tmpl"),
)
```

and `pages/index.md` exists.

This is similar to issue #2724 except that the problem is caused by taxonomies.  Making `taxonomy.should_generate_classification_page` return `False` in `nikola/plugins/task/taxonomies.py` is a workaround.

Now in addition to being a bug in the code, I think there's also a documentation problem here. This is a fresh nikola installation.  My conf.py doesn't mention taxonomy/taxonomies at all and searching google doesn't result obvious results on how to disable taxonomies (whatever that is).  Ahh, ok, the manual says "three taxonomy systems in Nikola" and tags and categories are enabled in the default config.  Still, maybe add the sentence about the three taxonomy systems to the config file.



Discussion:
The taxonomy in question would be indexes. I think we could make the error more relevant, by doing the check ourselves and displaying a neater warning. (`PAGE_INDEXES` already does, but disabling the blog index at random is probably not what users want)

As for the documentation issue, the config file is not a place where you should learn about how Nikola works.
I see now that `docs/creating-a-site.rst` even mentions this problem:

```
# And to avoid a conflict because blogs try to generate /index.html
INDEX_PATH = "blog"
```

In my case, with `""` as the root for pages and `blog` as the only root for posts, couldn't nikola set `INDEX_PATH` to `blog` automatically?

Oh, and I agree that th config file shouldn't be the documentation but it's confusing to get an error about `render_taxonomies` when there's nothing in the config file to disable taxonomies.  When I saw the message, my first reaction was `I didn't turn on taxonomies, wtf is it and how can I turn it off?` thinking that taxonomies is something I don't need (like a tag cloud or so... this could well be called "taxonomy").
btw, it would be good to mention `INDEX_PATH` in the default config.

Resolving patch:
diff --git a/nikola/plugins/task/pages.py b/nikola/plugins/task/pages.py
--- a/nikola/plugins/task/pages.py
+++ b/nikola/plugins/task/pages.py
@@ -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']


Test patch: