Best practice for setting the <base>
tag per page
#214
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: HPR/hpr_generator#214
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The current
<base>
setting per page is:This is not ideal for show notes.
When adding internal links to notes (such as footnotes, or links to sections of the notes) it's only possible to use relative links of the form
eps/hpr4227/#fn1
, because#fn1
will not be relative to the page, but to the site with this<base>
tag. Absolute links could be provided of course, but (as far as I know) Pandoc does not provide a method of adding a relative URL prefix to internal links, nor of making such links absolute, since notes are generated as HTML fragments.There is a similar issue when referring to "assets" like pictures and scripts from within the notes.
What should the
<base>
be, or should it be omitted?@davmo I originally added the baseurl config so I could test using my local files without needing a web server running. Modern browsers won't follow a relative link when the file:// protocol is part of the URL unless there is a meta tag set. This sandboxes the browser to just the directory structure of the website in your filesystem.
For a working website, the best practice would not be setting this at all. Then the links will be generated with the path, but not the protocol://host:port and relative links should work. That same idea is used for the various other ..._baseurl settings in the site.cfg