Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: getnikola/nikola
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: dce0ebca92ce
Choose a base ref
...
head repository: getnikola/nikola
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4058d3742386
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Dec 17, 2016

  1. Only add previous/following links for archive taxonomy (and every oth…

    …er taxonomy who sets a flag).
    felixfontein committed Dec 17, 2016
    Copy the full SHA
    90fc9fb View commit details
  2. Copy the full SHA
    4058d37 View commit details
Showing with 14 additions and 1 deletion.
  1. +9 −0 nikola/plugin_categories.py
  2. +1 −0 nikola/plugins/task/archive.py
  3. +4 −1 nikola/plugins/task/taxonomies.py
9 changes: 9 additions & 0 deletions nikola/plugin_categories.py
Original file line number Diff line number Diff line change
@@ -582,6 +582,14 @@ class Taxonomy(BasePlugin):
Whether to include all classifications for all languages in every
language, or only the classifications for one language in its language's
pages.
insert_classification_navigation_links = False:
If set to True, inserts links to previous and following
classifications (based on the order induced by natsort and
modified by Taxonomy.sort_classifications) and, for hierarchical
taxonomies, links to the parent (if exists), previous and following
siblings, and previous and following classifications on the same
hierarchy level.
"""

name = "dummy_taxonomy"
@@ -607,6 +615,7 @@ class Taxonomy(BasePlugin):
minimum_post_count_per_classification_in_overview = 1
omit_empty_classifications = False
also_create_classifications_from_other_languages = True
insert_classification_navigation_links = False

def is_enabled(self, lang=None):
"""Return True if this taxonomy is enabled, or False otherwise.
1 change: 1 addition & 0 deletions nikola/plugins/task/archive.py
Original file line number Diff line number Diff line change
@@ -52,6 +52,7 @@ class Archive(Taxonomy):
minimum_post_count_per_classification_in_overview = 1
omit_empty_classifications = False
also_create_classifications_from_other_languages = False
insert_classification_navigation_links = True

def set_site(self, site):
"""Set Nikola site."""
5 changes: 4 additions & 1 deletion nikola/plugins/task/taxonomies.py
Original file line number Diff line number Diff line change
@@ -470,8 +470,11 @@ def _generate_classification_page(self, taxonomy, classification, post_list, lan
kw["index_file"] = self.site.config['INDEX_FILE']
context = copy(context)
context["permalink"] = self.site.link(taxonomy.classification_name, classification, lang)
if taxonomy.has_hierarchy:
context["hierarchy_level"] = len(taxonomy.extract_hierarchy(classification))
# Links to previous/next classifications
self._add_cross_classification_navigation_links(taxonomy, classification, context, kw, lang, generate_list, generate_rss)
if taxonomy.insert_classification_navigation_links:
self._add_cross_classification_navigation_links(taxonomy, classification, context, kw, lang, generate_list, generate_rss)
# Decide what to do
if taxonomy.has_hierarchy and taxonomy.show_list_as_subcategories_list:
# Determine whether there are subcategories