Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2701 from getnikola/fixing-pages-index
Fixing pages index
  • Loading branch information
Kwpolska committed Mar 26, 2017
2 parents 958ff91 + 7098b49 commit ef4ecc7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Expand Up @@ -29,6 +29,8 @@ Features
Bugfixes
--------

* Fix crash if ``PAGE_INDEX`` is enabled and make them actually work
(Issue #2646)
* Ignore ``NEW_POST_DATE_PATH`` when creating pages (Issue #2699)
* Ensure ``post.updated`` is timezone-aware (Issue #2698)
* Pass previously missing post object and language to reST compiler
Expand All @@ -44,7 +46,6 @@ Bugfixes
* Fix crash if ``SHOW_INDEX_PAGE_NAVIGATION`` is ``True`` while
``INDEXES_STATIC`` is ``False``. (Issue #2654)
* Make ``NEW_POST_DATE_PATH`` follow ``rrule`` if it exists (issue #2653)
* Fix crash if ``PAGE_INDEX`` is enabled (Issue #2646)

New in v7.8.3
=============
Expand Down
4 changes: 3 additions & 1 deletion nikola/plugins/misc/taxonomies_classifier.py
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions nikola/plugins/task/page_index.py
Expand Up @@ -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."""
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion nikola/plugins/task/taxonomies.py
Expand Up @@ -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"]
Expand Down

0 comments on commit ef4ecc7

Please sign in to comment.