Browse Source

properly handle absolute paths

master
rra 5 years ago
parent
commit
d868d65c74
  1. 7
      page_metadata.py

7
page_metadata.py

@ -97,18 +97,15 @@ def generate_metadata(path, context):
if 'i18n_subsites' in plugins: if 'i18n_subsites' in plugins:
subsites = True subsites = True
lang = context['DEFAULT_LANG'] lang = context['DEFAULT_LANG']
general_output_path = output_path.replace(lang, '').strip('/') general_output_path = output_path.replace(lang, '')
siteurl = siteurl.replace(lang,'').strip('/') siteurl = context['main_siteurl']
media_size = 0 media_size = 0
# enumerate all media displayed on the page # enumerate all media displayed on the page
media, soup = get_media(path) #reuse the same soup to limit calculation media, soup = get_media(path) #reuse the same soup to limit calculation
for m in media: for m in media:
# filter out SITEURL to prevent trouble # filter out SITEURL to prevent trouble
#print(context['SITEURL'], m)
# join output path to file, need to strip any leading slash for os.path # join output path to file, need to strip any leading slash for os.path
if subsites: if subsites:
file_name = m.replace(context['main_siteurl']+'/', '') file_name = m.replace(context['main_siteurl']+'/', '')

Loading…
Cancel
Save