From 9d3bbd607687899d173e9087f2782d7460ebee82 Mon Sep 17 00:00:00 2001
From: Aiden Bai <aiden.bai05@gmail.com>
Date: Tue, 3 May 2022 08:53:18 -0700
Subject: [PATCH 1/4] Fix active node on graph

---
 assets/js/graph.js | 4 ++--
 data/config.yaml   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/assets/js/graph.js b/assets/js/graph.js
index c5829e9..c32035d 100644
--- a/assets/js/graph.js
+++ b/assets/js/graph.js
@@ -1,5 +1,5 @@
 async function drawGraph(
-  url,
+  _url,
   baseUrl,
   pathColors,
   depth,
@@ -10,7 +10,7 @@ async function drawGraph(
   const container = document.getElementById('graph-container')
 
   const { index, links, content } = await fetchData
-  const curPage = url.replace(baseUrl, '')
+  const curPage = window.location.href.replace(baseUrl, '').slice(0, -1)
 
   const parseIdsFromLinks = (links) => [
     ...new Set(links.flatMap((link) => [link.source, link.target])),
diff --git a/data/config.yaml b/data/config.yaml
index afa531c..2676ac2 100644
--- a/data/config.yaml
+++ b/data/config.yaml
@@ -3,7 +3,7 @@ enableToc: true
 openToc: false
 enableLinkPreview: true
 enableLatex: true
-enableSPA: false
+enableSPA: true
 description:
   Host your second brain and digital garden for free. Quartz features extremely fast full-text search,
   Wikilink support, backlinks, local graph, tags, and link previews.

From 3c660dd9b5f9e1133bc8a1228287508504b7c132 Mon Sep 17 00:00:00 2001
From: Aiden Bai <aiden.bai05@gmail.com>
Date: Tue, 3 May 2022 09:20:01 -0700
Subject: [PATCH 2/4] Remove unnecessary 'url' param in drawGraph

---
 assets/js/graph.js         | 1 -
 layouts/partials/head.html | 1 -
 2 files changed, 2 deletions(-)

diff --git a/assets/js/graph.js b/assets/js/graph.js
index c32035d..e92f7db 100644
--- a/assets/js/graph.js
+++ b/assets/js/graph.js
@@ -1,5 +1,4 @@
 async function drawGraph(
-  _url,
   baseUrl,
   pathColors,
   depth,
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 37938a5..93051cb 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -75,7 +75,6 @@
         container.textContent = "";
 
         drawGraph(
-          {{strings.TrimRight "/" .Page.Permalink}},
           {{strings.TrimRight "/" .Site.BaseURL}},
           {{$.Site.Data.graphConfig.paths}},
           {{$.Site.Data.graphConfig.depth}},

From 8d092a3a4aca9561f3ac852e01518f48c8ef68fe Mon Sep 17 00:00:00 2001
From: Aiden Bai <aiden.bai05@gmail.com>
Date: Tue, 3 May 2022 09:22:51 -0700
Subject: [PATCH 3/4] Remove unnecessary 'url' argument in graph.html

---
 layouts/partials/graph.html | 1 -
 1 file changed, 1 deletion(-)

diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html
index b8b2f61..6bc77b6 100644
--- a/layouts/partials/graph.html
+++ b/layouts/partials/graph.html
@@ -18,7 +18,6 @@
 <script src="{{ $js.Permalink }}"></script>
 <script>
 drawGraph(
-  {{strings.TrimRight "/" .Page.Permalink}},
   {{strings.TrimRight "/" .Site.BaseURL}},
   {{$.Site.Data.graphConfig.paths}},
   {{$.Site.Data.graphConfig.depth}},

From e646cdb0be7977f31fa1d619a5b9125875c73475 Mon Sep 17 00:00:00 2001
From: Aiden Bai <aiden.bai05@gmail.com>
Date: Tue, 3 May 2022 09:27:25 -0700
Subject: [PATCH 4/4] Use explicit regex for trailing slash trim

---
 assets/js/graph.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/assets/js/graph.js b/assets/js/graph.js
index e92f7db..db1cfe2 100644
--- a/assets/js/graph.js
+++ b/assets/js/graph.js
@@ -9,7 +9,7 @@ async function drawGraph(
   const container = document.getElementById('graph-container')
 
   const { index, links, content } = await fetchData
-  const curPage = window.location.href.replace(baseUrl, '').slice(0, -1)
+  const curPage = window.location.href.replace(baseUrl, "").replace(/\/$/g, "")
 
   const parseIdsFromLinks = (links) => [
     ...new Set(links.flatMap((link) => [link.source, link.target])),