fix(Article): resolve relative hrefs during navigation
This commit is contained in:
parent
99dd49b077
commit
f877a58a31
|
|
@ -108,7 +108,10 @@ export const Article: Component<ArticleProps & ParentProps> = (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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue