From 79f44b27f360609b76ea22521764628444be1fc9 Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Fri, 13 Dec 2024 09:22:18 +0000 Subject: [PATCH] hugo: fix fragment link navigation setting window location Per proposed fixes from Jorinde. Testing: * Visit preview path for modules reference * Ensure the browser URL is /docs/reference/modules/ * Scroll down to 'Resolving a package to a module' * Click on the 'build list' link in the first sentence of the second paragraph * Notice the URL updates to /docs/reference/modules/#glos-build-list * Click the back button in the browser * Ensure the browser URL is /docs/reference/modules/ Fixes cue-lang/cue#3615 Signed-off-by: Paul Jolly Preview-Path: /docs/reference/modules Change-Id: Iad9488348a3d0699fad0428cf00a793f2fcd3080 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1205727 TryBot-Result: CUEcueckoo Reviewed-by: Chief Cueckoo Reviewed-by: Jorinde --- hugo/assets/ts/main.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hugo/assets/ts/main.ts b/hugo/assets/ts/main.ts index e73b5a174..423b8edf3 100644 --- a/hugo/assets/ts/main.ts +++ b/hugo/assets/ts/main.ts @@ -104,7 +104,7 @@ class App { element.addEventListener('click', (e) => { e.preventDefault(); const target = element.getAttribute('href').replace(currentPath, ''); - window.history.replaceState(null, '', target); + window.location.href = target; scrollToHash(target); }); });