Skip to content
Permalink
Browse files

Fixes crash when page navigation is shown when using dynamic indexes …

…while INDEXES_PAGES_MAIN being False.
  • Loading branch information
felixfontein committed Jan 31, 2017
1 parent ff8e04b commit 024899eb9739040b13baa4e6d3a2e8cc93a6678f
Showing with 8 additions and 2 deletions.
  1. +8 −2 nikola/nikola.py
@@ -2474,7 +2474,10 @@ def generic_index_renderer(self, lang, posts, indexes_title, template_name, cont
# form [num_pages, 1, 2, ..., num_pages - 1] -- we order it
# via a map. This allows to not replicate the logic of
# utils.get_displayed_page_number() here.
temp_map = {page_number - 1: link for page_number, link in zip(displayed_page_numbers, page_links)}
if not kw["indexes_pages_main"] and not kw["indexes_static"]:
temp_map = {page_number: link for page_number, link in zip(displayed_page_numbers, page_links)}
else:
temp_map = {page_number - 1: link for page_number, link in zip(displayed_page_numbers, page_links)}
page_links_context = [temp_map[i] for i in range(num_pages)]
for i, post_list in enumerate(lists):
context = context_source.copy()
@@ -2526,7 +2529,10 @@ def generic_index_renderer(self, lang, posts, indexes_title, template_name, cont
context['show_index_page_navigation'] = kw['show_index_page_navigation']
if kw['show_index_page_navigation']:
context['page_links'] = page_links_context
context['current_page'] = ipages_i - 1
if not kw["indexes_pages_main"] and not kw["indexes_static"]:
context['current_page'] = ipages_i
else:
context['current_page'] = ipages_i - 1
context['prev_next_links_reversed'] = kw['indexes_static']
context["permalink"] = page_links[i]
output_name = os.path.join(kw['output_folder'], page_path(i, ipages_i, num_pages, False))

0 comments on commit 024899e

Please sign in to comment.
You can’t perform that action at this time.