From 6ba138b4fa4a9ed48a79fd2f65202c97b8d66e6f Mon Sep 17 00:00:00 2001 From: 1900 Date: Wed, 31 Jan 2024 01:58:09 +0800 Subject: [PATCH] feat: support selfhost umami (#764) * feat: support selfhsot umami * Update quartz/plugins/emitters/componentResources.ts Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> * Update quartz/plugins/emitters/componentResources.ts Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --------- Co-authored-by: Jacky Zhao Co-authored-by: Aaron Pham <29749331+aarnphm@users.noreply.github.com> --- quartz/cfg.ts | 1 + quartz/plugins/emitters/componentResources.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/quartz/cfg.ts b/quartz/cfg.ts index 153bbe21d..a7f79e3b8 100644 --- a/quartz/cfg.ts +++ b/quartz/cfg.ts @@ -16,6 +16,7 @@ export type Analytics = | { provider: "umami" websiteId: string + host?: string } export interface GlobalConfiguration { diff --git a/quartz/plugins/emitters/componentResources.ts b/quartz/plugins/emitters/componentResources.ts index f92c0a9b8..accc2611e 100644 --- a/quartz/plugins/emitters/componentResources.ts +++ b/quartz/plugins/emitters/componentResources.ts @@ -119,7 +119,7 @@ function addGlobalPageResources( } else if (cfg.analytics?.provider === "umami") { componentResources.afterDOMLoaded.push(` const umamiScript = document.createElement("script") - umamiScript.src = "https://analytics.umami.is/script.js" + umamiScript.src = cfg.analytics.host ?? "https://analytics.umami.is/script.js" umamiScript.setAttribute("data-website-id", "${cfg.analytics.websiteId}") umamiScript.async = true