From 6d49d975598cd7f48e2b7347c2b83d8aac6a2f56 Mon Sep 17 00:00:00 2001
From: Aswanth <aswanth366@gmail.com>
Date: Sat, 24 May 2025 04:55:07 +0000
Subject: [PATCH] fix(analytics): streamline posthog script loading and event capturing (#1974)

---
 quartz/util/resources.tsx |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/quartz/util/resources.tsx b/quartz/util/resources.tsx
index 72ae9e6..d95333e 100644
--- a/quartz/util/resources.tsx
+++ b/quartz/util/resources.tsx
@@ -1,5 +1,6 @@
 import { randomUUID } from "crypto"
 import { JSX } from "preact/jsx-runtime"
+import { QuartzPluginData } from "../plugins/vfile"
 
 export type JSResource = {
   loadTime: "beforeDOMReady" | "afterDOMReady"
@@ -62,4 +63,12 @@
 export interface StaticResources {
   css: CSSResource[]
   js: JSResource[]
+  additionalHead: (JSX.Element | ((pageData: QuartzPluginData) => JSX.Element))[]
+}
+
+export type StringResource = string | string[] | undefined
+export function concatenateResources(...resources: StringResource[]): StringResource {
+  return resources
+    .filter((resource): resource is string | string[] => resource !== undefined)
+    .flat()
 }

--
Gitblit v1.10.0