Permalink
Browse files

Fix #2069 -- proper locale support for section links

Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information...
Kwpolska committed Sep 11, 2015
1 parent bce97f0 commit 1c74d5958b6386e3c97b7877960d91f024719f44
Showing with 10 additions and 3 deletions.
  1. +2 −0 CHANGES.txt
  2. +8 −3 nikola/post.py
View
@@ -3,6 +3,7 @@ New in master
Features
--------
* Support UTF-8 paths and encoded links when the ``USE_SLUGIFY`` option
is disabled. (Issue #2037)
* Per-document hyphenation using "hyphenate" metadata flag.
@@ -17,6 +18,7 @@ Features
Bugfixes
--------
* Generate language-specific section links (Issue #2069)
* Handle metadata in post files that start with a BOM (Issue #2059)
* Handle error downloading bootswatches (Issue #2054)
* Monitor plugins/ in ``nikola auto`` (Issue #2044)
View
@@ -745,11 +745,16 @@ def section_color(self, lang=None):
def section_link(self, lang=None):
"""Return the link to the post's section."""
if lang is None:
lang = nikola.utils.LocaleBorg().current_lang
slug = self.section_slug(lang)
t = os.path.normpath(self.translations[lang])
if t == '.':
t = ''
link = '/' + '/'.join(i for i in (t, slug) if i) + '/'
if not self.pretty_urls:
link = urljoin('/' + slug + '/', self.index_file)
else:
link = '/' + slug + '/'
link = urljoin(link, self.index_file)
link = utils.encodelink(link)
return link

0 comments on commit 1c74d59

Please sign in to comment.