Repository: getnikola/nikola

Issue:
KeyError: page_index_folder_index
If setting PAGE_INDEX = True, with prety much default settings (except usual config), then I get:

```
$ nikola build
Traceback (most recent call last):
  File "/usr/local/bin/nikola", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.5/dist-packages/nikola/__main__.py", line 171, in main
    _ = DN.run(oargs)
  File "/usr/local/lib/python3.5/dist-packages/nikola/__main__.py", line 339, in run
    self.nikola.init_plugins()
  File "/usr/local/lib/python3.5/dist-packages/nikola/nikola.py", line 1077, in init_plugins
    self._activate_plugins_of_category("SignalHandler")
  File "/usr/local/lib/python3.5/dist-packages/nikola/nikola.py", line 1233, in _activate_plugins_of_category
    plugin_info.plugin_object.set_site(self)
  File "/usr/local/lib/python3.5/dist-packages/nikola/plugins/misc/taxonomies_classifier.py", line 328, in set_site
    self._register_path_handlers(taxonomy)
  File "/usr/local/lib/python3.5/dist-packages/nikola/plugins/misc/taxonomies_classifier.py", line 316, in _register_path_handlers
    doc = taxonomy.path_handler_docstrings[name]
KeyError: 'page_index_folder_index'
```

It seems silly, but I'd rather post this for others who might make the same mistake.



Discussion:
Ace, thanks folks. Love that label ("brown paper bag") too, made me LOL when I saw it.
Applied the patch locally myself, which fixes the crash.  But it doesn't render the index.  Setting STORY_INDEX = True gives a WARNING, but also doesn't render the index.  Here's my PAGES list:

```python
PAGES = (
    ("pages/*.rst", "pg", "story.tmpl"),
    ("pages/*.txt", "pg", "story.tmpl"),
    ("pages/*.ipynb", "pg", "story.tmpl"),
    ("pages/*.md", "pg", "story.tmpl"),
    ("old_site/stories/*.wp", "pg", "story.tmpl"),
)
```

So I'm expecting output/pg/index.html  (which was being rendered at least in 7.7.1) but it's not there.
@felixfontein, any ideas about why PAGE_INDEX doesn’t work at all?

Resolving patch:
diff --git a/nikola/plugins/misc/taxonomies_classifier.py b/nikola/plugins/misc/taxonomies_classifier.py
--- a/nikola/plugins/misc/taxonomies_classifier.py
+++ b/nikola/plugins/misc/taxonomies_classifier.py
@@ -59,7 +59,9 @@ def _do_classification(self, site):
 
         # Classify posts
         for post in site.timeline:
-            if not post.use_in_feeds:
+            # Do classify pages, but don’t classify posts that are hidden
+            # (draft/private/future)
+            if post.is_post and not post.use_in_feeds:
                 continue
             for taxonomy in taxonomies:
                 if taxonomy.apply_to_posts if post.is_post else taxonomy.apply_to_pages:
diff --git a/nikola/plugins/task/page_index.py b/nikola/plugins/task/page_index.py
--- a/nikola/plugins/task/page_index.py
+++ b/nikola/plugins/task/page_index.py
@@ -68,7 +68,7 @@ def classify(self, post, lang):
         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 ''
+        return [destpath[:i] if i >= 0 else '']
 
     def get_classification_friendly_name(self, dirname, lang, only_last_component=False):
         """Extract a friendly name from the classification."""
@@ -94,7 +94,7 @@ def provide_context_and_uptodate(self, dirname, lang, node=None):
         }
         context = {
             "title": self.site.config['BLOG_TITLE'](lang),
-            "pagekind": ["list", "front_page"] if dirname == '' else ["list"],
+            "pagekind": ["list", "front_page", "page_index"] if dirname == '' else ["list", "page_index"],
         }
         kw.update(context)
         return context, kw
diff --git a/nikola/plugins/task/taxonomies.py b/nikola/plugins/task/taxonomies.py
--- a/nikola/plugins/task/taxonomies.py
+++ b/nikola/plugins/task/taxonomies.py
@@ -250,7 +250,11 @@ def _generate_classification_page_as_list(self, taxonomy, classification, filter
         template_name = taxonomy.template_for_single_list
         output_name = os.path.join(self.site.config['OUTPUT_FOLDER'], self.site.path(kind, classification, lang))
         context["lang"] = lang
-        context["posts"] = filtered_posts
+        # list.tmpl expects a different format than list_post.tmpl (Issue #2701)
+        if template_name == 'list.tmpl':
+            context["items"] = [(post.title(), post.permalink(), None) for post in filtered_posts]
+        else:
+            context["posts"] = filtered_posts
         context["kind"] = kind
         if "pagekind" not in context:
             context["pagekind"] = ["list", "tag_page"]


Test patch: