Improve relative links by adding a head base.

This commit is contained in:
voussoir 2022-03-21 18:35:50 -07:00
parent d48677a632
commit d7d274dbfc
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB

View file

@ -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: