Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Handle absolute paths in POSTS / PAGES as relative to output/
  • Loading branch information
Roberto Alsina committed Mar 15, 2018
1 parent 26b7695 commit 5f76ad2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -32,6 +32,7 @@ Features
Bugfixes
--------

* Handle '/' and other absolute paths better in POSTS / PAGES
* Support KaTeX for reST display math (Issue #2888)
* Use npm for asset management instead of bower, which was deprecated
(Issue #2790)
Expand Down
6 changes: 3 additions & 3 deletions nikola/post.py
Expand Up @@ -182,14 +182,14 @@ def __init__(
# Fill default_metadata with stuff from the other languages
for lang in sorted(self.translated_to):
default_metadata.update(self.meta[lang])

# Compose paths
if self.folder_base is not None:
# Use translatable destination folders
self.folders = {}
for lang in self.config['TRANSLATIONS'].keys():
self.folders[lang] = os.path.normpath(os.path.join(
self.folder_base(lang), self.folder_relative))
if os.path.isabs(self.folder_base(lang)): # Issue 2982
self.folder_base[lang] = os.path.relpath(self.folder_base(lang), '/')
self.folders[lang] = os.path.normpath(os.path.join(self.folder_base(lang), self.folder_relative))
else:
# Old behavior (non-translatable destination path, normalized by scanner)
self.folders = {lang: self.folder_relative for lang in self.config['TRANSLATIONS'].keys()}
Expand Down

0 comments on commit 5f76ad2

Please sign in to comment.