From 1b999a792f881ff40ae2df489ea8a70ed6c9fbf3 Mon Sep 17 00:00:00 2001
From: saberzero1
Date: Wed, 18 Mar 2026 11:51:06 +0100
Subject: [PATCH] fix: expose base path via data-basepath attribute on body
Compute the base path from cfg.baseUrl and set it as a data attribute on
so client-side scripts can resolve links correctly when Quartz is
deployed to a subdirectory (e.g., user.github.io/repository).
---
quartz/components/renderPage.tsx | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx
index 42d49b342..f907e7d3f 100644
--- a/quartz/components/renderPage.tsx
+++ b/quartz/components/renderPage.tsx
@@ -266,10 +266,11 @@ export function renderPage(
const lang = componentData.fileData.frontmatter?.lang ?? cfg.locale?.split("-")[0] ?? "en"
const direction = i18n(cfg.locale).direction ?? "ltr"
+ const basePath = cfg.baseUrl ? new URL(`https://${cfg.baseUrl}`).pathname.replace(/\/$/, "") : ""
const doc = (
-
+
{frame.css && }