Project-relative links with Pandoc – musteresel's blog
I don't want to write something like ../../../posts/foo/bar.html
when linking from one blog post to another. A link like that would need to be changed when either the target (bar.html
) or the starting post moved to another location.
IMO it's far more convenient to just write posts/foo/bar.html
. This URL should be interpreted as relative with regard to the root directory of the blog / project.
Initially I abused the HTML <base>
tag for this. Adding
<base href="../../../">
to the head of a HTML page makes the browser prefix relative links like the above posts/foo/bar.html
with the URL given in the href
attribute (../../../
in this case).
This worked out pretty well at first. Or, at least until I needed a real relative link (as in relative to the current page). This is especially annoying because this
Read full article from Project-relative links with Pandoc – musteresel's blog
No comments:
Post a Comment