From f861a7c160a0b3be76a16c5bf2ea1a8d076a9662 Mon Sep 17 00:00:00 2001 From: Jacky Zhao Date: Wed, 15 Nov 2023 19:31:18 -0800 Subject: [PATCH] fix: regression where clicking anchors on the same page wouldn't set the anchor in the url --- quartz/components/scripts/spa.inline.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/quartz/components/scripts/spa.inline.ts b/quartz/components/scripts/spa.inline.ts index 0318ec348..bc13c9316 100644 --- a/quartz/components/scripts/spa.inline.ts +++ b/quartz/components/scripts/spa.inline.ts @@ -15,7 +15,7 @@ const isLocalUrl = (href: string) => { if (window.location.origin === url.origin) { return true } - } catch (e) {} + } catch (e) { } return false } @@ -109,6 +109,7 @@ function createRouter() { if (isSamePage(url) && url.hash) { const el = document.getElementById(decodeURIComponent(url.hash.substring(1))) el?.scrollIntoView() + history.pushState({}, "", url) return }