diff --git a/src/components/Article.tsx b/src/components/Article.tsx index 86572e1..ca4cb1e 100644 --- a/src/components/Article.tsx +++ b/src/components/Article.tsx @@ -108,7 +108,10 @@ export const Article: Component = (props) => { if (href.startsWith("#")) return; e.preventDefault(); - navigate(href); + // Resolve relative hrefs against the current page path so that + // e.g. "blah.md" on /content/page.md becomes /content/blah.md + const resolved = new URL(href, window.location.origin + window.location.pathname).pathname; + navigate(resolved); }; dom.addEventListener("click", onClick);