Improve relative links by adding a head base.
This commit is contained in:
parent
d48677a632
commit
d7d274dbfc
1 changed files with 5 additions and 0 deletions
|
@ -157,6 +157,11 @@ def soup_adjust_relative_links(soup, md_file, repo_path):
|
||||||
'''
|
'''
|
||||||
folder = pathclass.Path(md_file.parent)
|
folder = pathclass.Path(md_file.parent)
|
||||||
writing_rootdir = pathclass.Path(WRITING_ROOTDIR)
|
writing_rootdir = pathclass.Path(WRITING_ROOTDIR)
|
||||||
|
|
||||||
|
base = soup.new_tag('base')
|
||||||
|
base['href'] = f'https://voussoir.net/writing/{folder.basename}/'
|
||||||
|
soup.find('head').append(base)
|
||||||
|
|
||||||
def fixby(tagname, attribute):
|
def fixby(tagname, attribute):
|
||||||
links = soup.find_all(tagname)
|
links = soup.find_all(tagname)
|
||||||
for link in links:
|
for link in links:
|
||||||
|
|
Loading…
Reference in a new issue