Skip to content
Permalink
Browse files

Improving show_list_as_subcategories_list API.

  • Loading branch information
felixfontein committed Nov 27, 2016
1 parent 700e0b0 commit ad11c44beb4ce89c1a3a5ac4d16dd83e50f499a9
Showing with 13 additions and 7 deletions.
  1. +10 −5 nikola/plugin_categories.py
  2. +2 −1 nikola/plugins/task/archive.py
  3. +1 −1 nikola/plugins/task/taxonomies.py
@@ -515,17 +515,21 @@ class Taxonomy(BasePlugin):
posts into the list for the empty hierarchy [].
show_list_as_subcategories_list = False:
If not False, for every classification which has at least one
If True, for every classification which has at least one
subclassification, create a list of subcategories instead of a list/index
of posts. This is only used when has_hierarchy = True. If not False, this
must be the template name for the list; usually "list.tmpl".
If this is set to a string, it is recommended to set
include_posts_from_subhierarchies to True to get correct post counts.
of posts. This is only used when has_hierarchy = True. The template
specified in subcategories_list_template will be used. If this is set
to True, it is recommended to set include_posts_from_subhierarchies to
True to get correct post counts.
show_list_as_index = False:
Whether to show the posts for one classification as an index or
as a post list.
subcategories_list_template = "taxonomy_list":
The template to use for the subcategories list when
show_list_as_subcategories_list is True.
generate_atom_feeds_for_post_lists = False:
Whether to generate Atom feeds for post lists in case GENERATE_ATOM is set.
@@ -571,6 +575,7 @@ class Taxonomy(BasePlugin):
include_posts_into_hierarchy_root = False
show_list_as_subcategories_list = False
show_list_as_index = False
subcategories_list_template = "taxonomy_list"
generate_atom_feeds_for_post_lists = False
template_for_single_list = "tagindex.tmpl"
template_for_classification_overview = "list.tmpl"
@@ -44,6 +44,7 @@ class Archive(Taxonomy):
has_hierarchy = True
include_posts_from_subhierarchies = True
include_posts_into_hierarchy_root = True
subcategories_list_template = "list.tmpl"
generate_atom_feeds_for_post_lists = False
template_for_classification_overview = None
always_disable_rss = True
@@ -59,7 +60,7 @@ def set_site(self, site):
if (site.config['CREATE_MONTHLY_ARCHIVE'] and site.config['CREATE_SINGLE_ARCHIVE']) and not site.config['CREATE_FULL_ARCHIVES']:
raise Exception('Cannot create monthly and single archives at the same time.')
# Finish setup
self.show_list_as_subcategories_list = False if site.config['CREATE_FULL_ARCHIVES'] else "list.tmpl"
self.show_list_as_subcategories_list = not site.config['CREATE_FULL_ARCHIVES']
self.show_list_as_index = site.config['ARCHIVES_ARE_INDEXES']
self.template_for_single_list = "archiveindex.tmpl" if site.config['ARCHIVES_ARE_INDEXES'] else "list_post.tmpl"
# Determine maximum hierarchy height
@@ -235,7 +235,7 @@ def get_subnode_data(subnode):
lang,
[],
os.path.join(kw['output_folder'], self.site.path(taxonomy.classification_name, node.classification_name, lang)),
taxonomy.show_list_as_subcategories_list,
taxonomy.subcategories_list_template,
kw['filters'],
context,
)

0 comments on commit ad11c44

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