From 5871d63431a5cd96ff84203750c07a783a567b1c Mon Sep 17 00:00:00 2001 From: Mishig Date: Fri, 3 Jul 2026 23:04:30 +0200 Subject: [PATCH] fix(kit): keep shorthand doc URLs in the address bar on client-side nav After #792, clicking a shorthand doc link (/docs/lib/page) canonicalized the address bar to the full /docs/lib/version/lang/page URL. Restore the old svelteKitCustomClient behavior: SvelteKit still resolves the expanded path internally (partial loading), but once the navigation completes the history entry is rewritten back to the shorthand the user clicked. The anchor's href is also restored right after SvelteKit reads it, and modified clicks (cmd/ctrl/middle) are left untouched so new tabs open the shorthand URL. Caveat: back/forward onto a shorthand history entry falls back to a full page load (the server serves the same page there). Verified with a browser test on the built accelerate docs: shorthand click SPA-navigates AND the address bar shows /docs/accelerate/quicktour. Co-Authored-By: Claude Fable 5 --- kit/src/routes/+layout.svelte | 49 +++++++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/kit/src/routes/+layout.svelte b/kit/src/routes/+layout.svelte index 1d2bf193..171d0955 100644 --- a/kit/src/routes/+layout.svelte +++ b/kit/src/routes/+layout.svelte @@ -1,6 +1,7 @@ {#if !import.meta.env.DEV}