Skip to content

Commit

Permalink
Fix #2069 -- proper locale support for section links
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Sep 11, 2015
1 parent bce97f0 commit 1c74d59
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGES.txt
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
11 changes: 8 additions & 3 deletions nikola/post.py
Expand Up @@ -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

Expand Down

0 comments on commit 1c74d59

Please sign in to comment.