Skip to content

Commit

Permalink
Only add previous/following links for archive taxonomy (and every oth…
Browse files Browse the repository at this point in the history
…er taxonomy who sets a flag).
  • Loading branch information
felixfontein committed Dec 25, 2016
1 parent 117caf9 commit f7c8993
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
9 changes: 9 additions & 0 deletions nikola/plugin_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.
Expand Down
1 change: 1 addition & 0 deletions nikola/plugins/task/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
3 changes: 2 additions & 1 deletion nikola/plugins/task/taxonomies.py
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,8 @@ def _generate_classification_page(self, taxonomy, classification, post_list, lan
context = copy(context)
context["permalink"] = self.site.link(taxonomy.classification_name, classification, lang)
# 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
Expand Down

0 comments on commit f7c8993

Please sign in to comment.