Skip to content

Commit

Permalink
Rename TAG_PAGES_{TITLES,DESCRIPTIONS} → TAG_{TITLES,DESCRIPTIONS} to…
Browse files Browse the repository at this point in the history
… match category renames

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed May 5, 2018
1 parent 742825e commit a788b89
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -32,6 +32,8 @@ Features
* Tags ``draft``, ``private`` and ``mathjax`` are no longer treated
special if ``USE_TAG_METADATA`` is set to ``False`` (default for
new sites) (Issue #2761)
* Rename ``TAG_PAGES_TITLES`` → ``TAG_TITLES``,
``TAG_PAGES_DESCRIPTIONS`` → ``TAG_DESCRIPTIONS``.
* Rename ``CATEGORY_PAGES_TITLES`` → ``CATEGORY_TITLES``,
``CATEGORY_PAGES_DESCRIPTIONS`` → ``CATEGORY_DESCRIPTIONS``.
* Produce a better error message when a template referenced in another
Expand Down
4 changes: 2 additions & 2 deletions docs/manual.rst
Expand Up @@ -982,8 +982,8 @@ Configuring tags and categories
There are multiple configuration variables dedicated to each of the two taxonomies. You can set:

* ``TAG_PATH``, ``TAGS_INDEX_PATH``, ``CATEGORY_PATH``, ``CATEGORY_PREFIX`` to configure paths used for tags and categories
* ``TAG_PAGES_TITLES``, ``CATEGORY_TITLES`` to set titles and descriptions for index pages
* ``TAG_PAGES_DESCRIPTIONS``, ``CATEGORY_DESCRIPTIONS`` to set descriptions for each of the items
* ``TAG_TITLES``, ``CATEGORY_TITLES`` to set titles and descriptions for index pages
* ``TAG_DESCRIPTIONS``, ``CATEGORY_DESCRIPTIONS`` to set descriptions for each of the items
* ``CATEGORY_ALLOW_HIERARCHIES`` and ``CATEGORY_OUTPUT_FLAT_HIERARCHIES`` to allow hierarchical categories
* ``TAG_PAGES_ARE_INDEXES`` and ``CATEGORY_PAGES_ARE_INDEXES`` to display full-size indexes instead of simple post lists
* ``WRITE_TAG_CLOUDS`` to enable/disable generating tag cloud files
Expand Down
4 changes: 2 additions & 2 deletions nikola/conf.py.in
Expand Up @@ -264,15 +264,15 @@ WRITE_TAG_CLOUD = False
# Set descriptions for tag pages to make them more interesting. The
# default is no description. The value is used in the meta description
# and displayed underneath the tag list or index page’s title.
# TAG_PAGES_DESCRIPTIONS = {
# TAG_DESCRIPTIONS = {
# DEFAULT_LANG: {
# "blogging": "Meta-blog posts about blogging about blogging.",
# "open source": "My contributions to my many, varied, ever-changing, and eternal libre software projects."
# },
# }

# Set special titles for tag pages. The default is "Posts about TAG".
# TAG_PAGES_TITLES = {
# TAG_TITLES = {
# DEFAULT_LANG: {
# "blogging": "Meta-posts about blogging",
# "open source": "Posts about open source software"
Expand Down
12 changes: 10 additions & 2 deletions nikola/nikola.py
Expand Up @@ -561,8 +561,8 @@ def __init__(self, **config):
'STRIP_INDEXES': True,
'TAG_PATH': 'categories',
'TAG_PAGES_ARE_INDEXES': False,
'TAG_PAGES_DESCRIPTIONS': {},
'TAG_PAGES_TITLES': {},
'TAG_DESCRIPTIONS': {},
'TAG_TITLES': {},
'TAG_TRANSLATIONS': [],
'TAG_TRANSLATIONS_ADD_DEFAULTS': False,
'TAGS_INDEX_PATH': '',
Expand Down Expand Up @@ -717,6 +717,14 @@ def __init__(self, **config):
utils.LOGGER.warn('The UNSLUGIFY_TITLES setting was renamed to FILE_METADATA_UNSLUGIFY_TITLES.')
self.config['FILE_METADATA_UNSLUGIFY_TITLES'] = self.config['UNSLUGIFY_TITLES']

if 'TAG_PAGES_TITLES' in self.config:
utils.LOGGER.warn('The TAG_PAGES_TITLES setting was renamed to TAG_TITLES.')
self.config['TAG_TITLES'] = self.config['TAG_PAGES_TITLES']

if 'TAG_PAGES_DESCRIPTIONS' in self.config:
utils.LOGGER.warn('The TAG_PAGES_DESCRIPTIONS setting was renamed to TAG_DESCRIPTIONS.')
self.config['TAG_DESCRIPTIONS'] = self.config['TAG_PAGES_DESCRIPTIONS']

if 'CATEGORY_PAGES_TITLES' in self.config:
utils.LOGGER.warn('The CATEGORY_PAGES_TITLES setting was renamed to CATEGORY_TITLES.')
self.config['CATEGORY_TITLES'] = self.config['CATEGORY_PAGES_TITLES']
Expand Down
12 changes: 6 additions & 6 deletions nikola/plugins/task/tags.py
Expand Up @@ -119,8 +119,8 @@ def provide_overview_context_and_uptodate(self, lang):
"tag_pages_are_indexes": self.site.config['TAG_PAGES_ARE_INDEXES'],
"taglist_minimum_post_count": self.site.config['TAGLIST_MINIMUM_POSTS'],
"tzinfo": self.site.tzinfo,
"tag_pages_descriptions": self.site.config['TAG_PAGES_DESCRIPTIONS'],
"tag_pages_titles": self.site.config['TAG_PAGES_TITLES'],
"tag_descriptions": self.site.config['TAG_DESCRIPTIONS'],
"tag_titles": self.site.config['TAG_TITLES'],
}
context = {
"title": self.site.MESSAGES[lang]["Tags"],
Expand All @@ -137,12 +137,12 @@ def provide_context_and_uptodate(self, classification, lang, node=None):
"tag_pages_are_indexes": self.site.config['TAG_PAGES_ARE_INDEXES'],
"taglist_minimum_post_count": self.site.config['TAGLIST_MINIMUM_POSTS'],
"tzinfo": self.site.tzinfo,
"tag_pages_descriptions": self.site.config['TAG_PAGES_DESCRIPTIONS'],
"tag_pages_titles": self.site.config['TAG_PAGES_TITLES'],
"tag_descriptions": self.site.config['TAG_DESCRIPTIONS'],
"tag_titles": self.site.config['TAG_TITLES'],
}
context = {
"title": self.site.config['TAG_PAGES_TITLES'].get(lang, {}).get(classification, self.site.MESSAGES[lang]["Posts about %s"] % classification),
"description": self.site.config['TAG_PAGES_DESCRIPTIONS'].get(lang, {}).get(classification),
"title": self.site.config['TAG_TITLES'].get(lang, {}).get(classification, self.site.MESSAGES[lang]["Posts about %s"] % classification),
"description": self.site.config['TAG_DESCRIPTIONS'].get(lang, {}).get(classification),
"pagekind": ["tag_page", "index" if self.show_list_as_index else "list"],
"tag": classification,
}
Expand Down

0 comments on commit a788b89

Please sign in to comment.