From f861a7c160a0b3be76a16c5bf2ea1a8d076a9662 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Thu, 16 Nov 2023 03:31:18 +0000
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 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/quartz/components/scripts/spa.inline.ts b/quartz/components/scripts/spa.inline.ts
index 0318ec3..bc13c93 100644
--- a/quartz/components/scripts/spa.inline.ts
+++ b/quartz/components/scripts/spa.inline.ts
@@ -15,7 +15,7 @@
     if (window.location.origin === url.origin) {
       return true
     }
-  } catch (e) {}
+  } catch (e) { }
   return false
 }
 
@@ -109,6 +109,7 @@
       if (isSamePage(url) && url.hash) {
         const el = document.getElementById(decodeURIComponent(url.hash.substring(1)))
         el?.scrollIntoView()
+        history.pushState({}, "", url)
         return
       }
 

--
Gitblit v1.10.0