Skip to content
Permalink
Browse files

Fix #1949 -- make STORY_INDEXES+PRETTY_URLS work

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Aug 17, 2015
1 parent 1bcf996 commit 1eedcdfbc4e2a0315e2495b588e92720c1f6f674
Showing with 6 additions and 2 deletions.
  1. +1 −0 CHANGES.txt
  2. +5 −2 nikola/plugins/task/indexes.py
@@ -10,6 +10,7 @@ Features
Bugfixes
--------

* Make STORY_INDEX work together with PRETTY_URLS (Issue #1949)
* Refactor new_post to match lazy plugin loading (Issue #1943)
* Make Nikola startup faster by not loading useless plugins (Issue #1825)
* Ignore sliced multibyte characters when reading metadata for sitemaps
@@ -101,13 +101,17 @@ def page_path(i, displayed_i, num_pages, force_addition, extension=None):
"strip_indexes": self.site.config['STRIP_INDEXES'],
}
template_name = "list.tmpl"
index_len = len(kw['index_file'])
for lang in kw["translations"]:
# Need to group by folder to avoid duplicated tasks (Issue #758)
# Group all pages by path prefix
groups = defaultdict(list)
for p in self.site.timeline:
if not p.is_post:
dirname = os.path.dirname(p.destination_path(lang))
destpath = p.destination_path(lang)
if destpath[-(1 + index_len):] == '/' + kw['index_file']:
destpath = destpath[:-(1 + index_len)]
dirname = os.path.dirname(destpath)
groups[dirname].append(p)
for dirname, post_list in groups.items():
context = {}
@@ -116,7 +120,6 @@ def page_path(i, displayed_i, num_pages, force_addition, extension=None):
output_name = os.path.join(kw['output_folder'], dirname, kw['index_file'])
short_destination = os.path.join(dirname, kw['index_file'])
link = short_destination.replace('\\', '/')
index_len = len(kw['index_file'])
if kw['strip_indexes'] and link[-(1 + index_len):] == '/' + kw['index_file']:
link = link[:-index_len]
context["permalink"] = link

0 comments on commit 1eedcdf

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