Skip to content

Commit

Permalink
Fix #1931
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Aug 6, 2015
1 parent 29c2fae commit 3d152c8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -11,6 +11,7 @@ Features
Bugfixes
--------

* Rebuild archives when post slugs and titles change (Issue #1931)
* Handle special characters in URLs in nikola auto (Issue #1925)
* Avoid Broken Pipe error in nikola auto (Issue #1906)
* "nikola auto" serving implicit index.html with wrong mime type (Issue #1921)
Expand Down
10 changes: 6 additions & 4 deletions nikola/plugins/task/archive.py
Expand Up @@ -58,18 +58,20 @@ def _prepare_task(self, kw, name, lang, posts, items, template_name,
# title: the (translated) title for the generated page
# deps_translatable: dependencies (None if not added)
assert posts is not None or items is not None

task_cfg = [copy.copy(kw)]
context = {}
context["lang"] = lang
context["title"] = title
context["permalink"] = self.site.link("archive", name, lang)
context["pagekind"] = ["list", "archive_page"]
if posts is not None:
context["posts"] = posts
n = len(posts)
# Depend on all post metadata because it can be used in templates (Issue #1931)
task_cfg.append(repr(p) for p in posts)
else:
# Depend on the content of items, to rebuild if links change (Issue #1931)
context["items"] = items
n = len(items)
task_cfg.append(items)
task = self.site.generic_post_list_renderer(
lang,
[],
Expand All @@ -79,7 +81,7 @@ def _prepare_task(self, kw, name, lang, posts, items, template_name,
context,
)

task_cfg = {1: copy.copy(kw), 2: n}
task_cfg = {i: x for i, x in enumerate(task_cfg)}
if deps_translatable is not None:
task_cfg[3] = deps_translatable
task['uptodate'] = task['uptodate'] + [config_changed(task_cfg, 'nikola.plugins.task.archive')]
Expand Down

0 comments on commit 3d152c8

Please sign in to comment.