Skip to content

Commit aed63be

Browse files
committed
fix hashchange event
1 parent ec3fec7 commit aed63be

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

logseq/custom.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,12 @@ if (document.querySelector("html").getAttribute("data-theme") === "light") {
1010
}
1111

1212
document.querySelector(".journals-nav .flex-1").innerHTML = "Blog";
13+
14+
// Override the pushState method for correct hashchange event (for analytics)
15+
// seems router issue
16+
const originalPushState = history.pushState;
17+
18+
history.pushState = function (state, title, url) {
19+
originalPushState.apply(history, arguments);
20+
window.dispatchEvent(new Event("hashchange"));
21+
};

0 commit comments

Comments
 (0)