From 41c443dbf079e65ed69f57d3b9a5ce58dc403e6d Mon Sep 17 00:00:00 2001
From: earnest ma <me@earne.link>
Date: Fri, 11 Feb 2022 22:15:28 +0000
Subject: [PATCH] Add disableToc parameter to not show TOC on a page

---
 layouts/partials/graph.html |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/layouts/partials/graph.html b/layouts/partials/graph.html
index f089356..10243bb 100644
--- a/layouts/partials/graph.html
+++ b/layouts/partials/graph.html
@@ -11,10 +11,7 @@
     }
 </style>
 <script>
-  const index = {{$.Site.Data.linkIndex.index}}
-  const links = {{$.Site.Data.linkIndex.links}}
-  const content = {{$.Site.Data.contentIndex}}
-  const curPage = {{ strings.TrimRight "/" .Page.RelPermalink }}
+  const curPage = {{ strings.TrimRight "/" .Page.Permalink }}.replace({{strings.TrimRight "/" .Site.BaseURL }}, "")
   const pathColors = {{$.Site.Data.graphConfig.paths}}
   let depth = {{$.Site.Data.graphConfig.depth}}
 
@@ -146,7 +143,7 @@
     .attr("fill", color)
     .style("cursor", "pointer")
     .on("click", (_, d) => {
-      window.location.href = {{.Site.BaseURL}} + decodeURI(d.id).replace(/[\s_]+/g, '-')
+      window.location.href = {{.Site.BaseURL}} + decodeURI(d.id).replace(/\s+/g, '-')
     })
     .on("mouseover", function (_, d) {
       d3.selectAll(".node")
@@ -204,7 +201,7 @@
   const labels = graphNode.append("text")
     .attr("dx", 12)
     .attr("dy", ".35em")
-    .text((d) => content[decodeURI(d.id).replace(/[\s_]+/g, '-')]?.title || "Untitled")
+    .text((d) => content[decodeURI(d.id).replace(/\s+/g, '-')]?.title || "Untitled")
     .style("opacity", 0)
     .style("pointer-events", "none")
     .call(drag(simulation));

--
Gitblit v1.10.0