Skip to content

Commit

Permalink
Fixed confusion about rss_link.
Browse files Browse the repository at this point in the history
  • Loading branch information
felixfontein committed Oct 20, 2016
1 parent 7b4d25c commit 3d40b40
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 19 deletions.
3 changes: 1 addition & 2 deletions nikola/plugin_categories.py
Expand Up @@ -651,8 +651,7 @@ def provide_context_and_uptodate(self, classification, lang):
Must return a tuple of two dicts. The first is merged into the page's context,
the second will be put into the uptodate list of all generated tasks.
Context must contain `title`, which should be something like 'Posts about <classification>',
and `classification_title`, which should be related to the classification string.
Context must contain `title`, which should be something like 'Posts about <classification>'.
"""
raise NotImplementedError()

Expand Down
1 change: 0 additions & 1 deletion nikola/plugins/task/archive.py
Expand Up @@ -156,7 +156,6 @@ def provide_context_and_uptodate(self, classification, lang):
raise Exception("Cannot interpret classification {}!".format(repr(classification)))
context = {
"title": title,
"classification_title": classification,
"pagekind": [page_kind, "archive_page"],
}
if page_kind == 'index':
Expand Down
5 changes: 4 additions & 1 deletion nikola/plugins/task/authors.py
Expand Up @@ -107,10 +107,13 @@ def provide_context_and_uptodate(self, author, lang):
context = {
"author": author,
"title": kw["messages"][lang]["Posts by %s"] % author,
"classification_title": author,
"description": descriptions[lang][author] if lang in descriptions and author in descriptions[lang] else None,
"pagekind": ["index" if self.show_list_as_index else "list", "author_page"],
}
if self.site.config["GENERATE_RSS"]:
rss_link = ("""<link rel="alternate" type="application/rss+xml" title="RSS for author {0} ({1})" href="{2}">""".format(
author, lang, self.site.link('author_rss', classification, lang)))
context['rss_link'] = rss_link
kw.update(context)
return context, kw

Expand Down
1 change: 0 additions & 1 deletion nikola/plugins/task/indexes.py
Expand Up @@ -87,7 +87,6 @@ def provide_context_and_uptodate(self, classification, lang):
}
context = {
"title": self.site.config["INDEXES_TITLE"](lang) or self.site.config["BLOG_TITLE"](lang),
"classification_title": "",
"description": self.site.config["BLOG_DESCRIPTION"](lang),
"pagekind": ["main_index", "index"],
}
Expand Down
1 change: 0 additions & 1 deletion nikola/plugins/task/page_index.py
Expand Up @@ -89,7 +89,6 @@ def provide_context_and_uptodate(self, dirname, lang):
}
context = {
"title": self.site.config['BLOG_TITLE'](lang),
"classification_title": self.site.config['BLOG_TITLE'](lang),
"pagekind": ["list", "front_page"] if dirname == '' else ["list"],
}
kw.update(context)
Expand Down
10 changes: 1 addition & 9 deletions nikola/plugins/task/sections.py
Expand Up @@ -83,14 +83,7 @@ def get_path(self, section, lang, type='page'):
return [_f for _f in [self.site.config['TRANSLATIONS'][lang], section] if _f], 'always'

def provide_context_and_uptodate(self, section, lang):
"""Provide data for the context and the uptodate list for the list of the given classifiation.
Must return a tuple of two dicts. The first is merged into the page's context,
the second will be put into the uptodate list of all generated tasks.
Context must contain `title`, which should be something like 'Posts about <classification>',
and `classification_title`, which should be related to the classification string.
"""
"""Provide data for the context and the uptodate list for the list of the given classifiation."""
kw = {
"messages": self.site.MESSAGES,
}
Expand All @@ -107,7 +100,6 @@ def provide_context_and_uptodate(self, section, lang):
# Compose context
context = {
"title": section_title,
"classification_title": section_name,
"description": self.site.config['POSTS_SECTION_DESCRIPTIONS'](lang)[section] if section in self.site.config['POSTS_SECTION_DESCRIPTIONS'](lang) else "",
"pagekind": ["section_page", "index" if self.show_list_as_index else "list"]
}
Expand Down
4 changes: 0 additions & 4 deletions nikola/plugins/task/taxonomies.py
Expand Up @@ -157,10 +157,6 @@ def page_path(i, displayed_i, num_pages, force_addition, extension=None):
return utils.adjust_name_for_index_path(self.site.path(feed.format(kind), classification, lang), i, displayed_i, lang, self.site, force_addition, extension)

context = copy(context)
if kw["generate_rss"] and not taxonomy.always_disable_rss:
rss_link = ("""<link rel="alternate" type="application/rss+xml" title="RSS for {0} {1} ({2})" href="{3}">""".format(
taxonomy.classification_name, context['classification_title'], lang, self.site.link('{}_rss'.format(kind), classification, lang)))
context['rss_link'] = rss_link
if "pagekind" not in context:
context["pagekind"] = ["index", "tag_page"]
template_name = taxonomy.template_for_list_of_one_classification
Expand Down

0 comments on commit 3d40b40

Please sign in to comment.