From 8cf3e3001f2cbd18da73fcc92ae5f4b76d3ecf21 Mon Sep 17 00:00:00 2001
From: Patsagorn Y. <49602385+ptsgrn@users.noreply.github.com>
Date: Thu, 16 Jan 2025 20:44:33 +0000
Subject: [PATCH] feat(i18n): Thai translations (#1722)

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

diff --git a/quartz/plugins/index.ts b/quartz/plugins/index.ts
index 9753d2e..df9fd1d 100644
--- a/quartz/plugins/index.ts
+++ b/quartz/plugins/index.ts
@@ -18,6 +18,23 @@
     }
   }
 
+  // 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
 }
 
@@ -30,5 +47,6 @@
   interface DataMap {
     slug: FullSlug
     filePath: FilePath
+    relativePath: FilePath
   }
 }

--
Gitblit v1.10.0