From 05e4f4229100e0420316072fda9e8ddc6229db5f Mon Sep 17 00:00:00 2001
From: Justin <127172022+jl33-ai@users.noreply.github.com>
Date: Wed, 17 Sep 2025 16:32:25 +0000
Subject: [PATCH] docs: update nav for cloudflare pages (#2130)

---
 quartz/plugins/index.ts |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/quartz/plugins/index.ts b/quartz/plugins/index.ts
index f35d053..c41157c 100644
--- a/quartz/plugins/index.ts
+++ b/quartz/plugins/index.ts
@@ -6,9 +6,10 @@
   const staticResources: StaticResources = {
     css: [],
     js: [],
+    additionalHead: [],
   }
 
-  for (const transformer of ctx.cfg.plugins.transformers) {
+  for (const transformer of [...ctx.cfg.plugins.transformers, ...ctx.cfg.plugins.emitters]) {
     const res = transformer.externalResources ? transformer.externalResources(ctx) : {}
     if (res?.js) {
       staticResources.js.push(...res.js)
@@ -16,6 +17,26 @@
     if (res?.css) {
       staticResources.css.push(...res.css)
     }
+    if (res?.additionalHead) {
+      staticResources.additionalHead.push(...res.additionalHead)
+    }
+  }
+
+  // if serving locally, listen for rebuilds and reload the page
+  if (ctx.argv.serve) {
+    const wsUrl = ctx.argv.remoteDevHost
+      ? `wss://${ctx.argv.remoteDevHost}:${ctx.argv.wsPort}`
+      : `ws://localhost:${ctx.argv.wsPort}`
+
+    staticResources.js.push({
+      loadTime: "afterDOMReady",
+      contentType: "inline",
+      script: `
+        const socket = new WebSocket('${wsUrl}')
+        // reload(true) ensures resources like images and scripts are fetched again in firefox
+        socket.addEventListener('message', () => document.location.reload(true))
+      `,
+    })
   }
 
   return staticResources

--
Gitblit v1.10.0