From 265faef4e8717eab9678a5515ca9150b7776b148 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Tue, 18 Jun 2024 04:43:32 +0000
Subject: [PATCH] fix: properly compute relative path for explorer (closes #1055, #1066)

---
 quartz/plugins/emitters/componentResources.ts |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts
index 81d3af2..e6725d9 100644
--- a/quartz/plugins/emitters/componentResources.ts
+++ b/quartz/plugins/emitters/componentResources.ts
@@ -136,6 +136,14 @@
       posthog.init('${cfg.analytics.apiKey}',{api_host:'${cfg.analytics.host ?? "https://app.posthog.com"}'})\`
       document.head.appendChild(posthogScript)
     `)
+  } else if (cfg.analytics?.provider === "tinylytics") {
+    const siteId = cfg.analytics.siteId
+    componentResources.afterDOMLoaded.push(`
+      const tinylyticsScript = document.createElement("script")
+      tinylyticsScript.src = "https://tinylytics.app/embed/${siteId}.js"
+      tinylyticsScript.defer = true
+      document.head.appendChild(tinylyticsScript)
+    `)
   }
 
   if (cfg.enableSPA) {

--
Gitblit v1.10.0