diff --git a/pelican/utils.py b/pelican/utils.py index 767dc117..79387357 100644 --- a/pelican/utils.py +++ b/pelican/utils.py @@ -133,8 +133,12 @@ def clean_output_dir(path): def get_relative_path(filename): - """Return the relative path to the given filename""" - return '../' * filename.count('/') + '.' + """Return the relative path from the given filename to the root path.""" + nslashes = filename.count('/') + if nslashes == 0: + return '.' + else: + return '/'.join(['..'] * nslashes) def truncate_html_words(s, num, end_text='...'): diff --git a/tests/output/basic/author/alexis-metaireau.html b/tests/output/basic/author/alexis-metaireau.html index 1953d75a..106e3581 100644 --- a/tests/output/basic/author/alexis-metaireau.html +++ b/tests/output/basic/author/alexis-metaireau.html @@ -3,30 +3,30 @@ A Pelican Blog - Alexis Métaireau - + + + + @@ -34,17 +34,17 @@