mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Change the way to compute relative paths to avoid the leading .././ when using
relative urls.
This commit is contained in:
parent
c731edcdeb
commit
088c810b00
3 changed files with 10 additions and 6 deletions
|
|
@ -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='...'):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue