Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5f76ad2

Browse files
author
Roberto Alsina
committedMar 15, 2018
Handle absolute paths in POSTS / PAGES as relative to output/
1 parent 26b7695 commit 5f76ad2

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed
 

‎CHANGES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ Features
3232
Bugfixes
3333
--------
3434

35+
* Handle '/' and other absolute paths better in POSTS / PAGES
3536
* Support KaTeX for reST display math (Issue #2888)
3637
* Use npm for asset management instead of bower, which was deprecated
3738
(Issue #2790)

‎nikola/post.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -182,14 +182,14 @@ def __init__(
182182
# Fill default_metadata with stuff from the other languages
183183
for lang in sorted(self.translated_to):
184184
default_metadata.update(self.meta[lang])
185-
186185
# Compose paths
187186
if self.folder_base is not None:
188187
# Use translatable destination folders
189188
self.folders = {}
190189
for lang in self.config['TRANSLATIONS'].keys():
191-
self.folders[lang] = os.path.normpath(os.path.join(
192-
self.folder_base(lang), self.folder_relative))
190+
if os.path.isabs(self.folder_base(lang)): # Issue 2982
191+
self.folder_base[lang] = os.path.relpath(self.folder_base(lang), '/')
192+
self.folders[lang] = os.path.normpath(os.path.join(self.folder_base(lang), self.folder_relative))
193193
else:
194194
# Old behavior (non-translatable destination path, normalized by scanner)
195195
self.folders = {lang: self.folder_relative for lang in self.config['TRANSLATIONS'].keys()}

0 commit comments

Comments
 (0)