From 8d092a3a4aca9561f3ac852e01518f48c8ef68fe Mon Sep 17 00:00:00 2001
From: Aiden Bai <aiden.bai05@gmail.com>
Date: Tue, 03 May 2022 16:22:51 +0000
Subject: [PATCH] Remove unnecessary 'url' argument in graph.html
---
layouts/partials/head.html | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 3b14850..93051cb 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -58,6 +58,7 @@
content,
}))
</script>
+ {{if $.Site.Data.config.enableSPA}}
<script type="module">
import { router, navigate } from "https://unpkg.com/million/dist/router.mjs";
// SPA navigation for access later
@@ -65,7 +66,7 @@
// We only mutate document.title and content within .singlePage element
router(".singlePage");
const callback = () => {
- // requestAnimationFrame()
+ // requestAnimationFrame() delays graph draw until SPA routing is finished
const draw = () => {
const container = document.getElementById("graph-container");
// retry if the graph is not ready
@@ -74,7 +75,6 @@
container.textContent = "";
drawGraph(
- {{strings.TrimRight "/" .Page.Permalink}},
{{strings.TrimRight "/" .Site.BaseURL}},
{{$.Site.Data.graphConfig.paths}},
{{$.Site.Data.graphConfig.depth}},
@@ -89,5 +89,8 @@
window.addEventListener("million:navigate", callback);
window.addEventListener("DOMContentLoaded", callback);
</script>
+ {{else}}
+ <script>window.navigate = (url) => window.location.href = url</script>
+ {{end}}
</head>
{{ template "_internal/google_analytics.html" . }}
--
Gitblit v1.10.0