From f877a58a3109d9eebcc03fd041200df90d6c290b Mon Sep 17 00:00:00 2001 From: hypercross Date: Tue, 14 Jul 2026 14:18:26 +0800 Subject: [PATCH] fix(Article): resolve relative hrefs during navigation --- src/components/Article.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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);