From 81fe2d24936ad4b783f41b260b4a4801bacb654b Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 03 May 2022 14:44:56 +0000
Subject: [PATCH] Merge branch 'hugo' of https://github.com/jackyzha0/quartz into hugo

---
 layouts/partials/head.html |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index 3b14850..37938a5 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
@@ -89,5 +90,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