diff --git a/quartz/components/renderPage.tsx b/quartz/components/renderPage.tsx index 4643d0a3a..51b35e1f7 100644 --- a/quartz/components/renderPage.tsx +++ b/quartz/components/renderPage.tsx @@ -213,7 +213,10 @@ export function renderPage( const doc = (
+Preview is disabled for this page.
` + elts = [noPreview] + } else elts = [...html.getElementsByClassName("popover-hint")] + if (elts.length === 0) return const popoverElement = document.createElement("div") diff --git a/quartz/components/scripts/search.inline.ts b/quartz/components/scripts/search.inline.ts index a75f4ff46..7f4fead80 100644 --- a/quartz/components/scripts/search.inline.ts +++ b/quartz/components/scripts/search.inline.ts @@ -371,6 +371,11 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => { throw new Error(`Could not fetch ${targetUrl}`) } const html = p.parseFromString(contents ?? "", "text/html") + if (html.body.dataset.enablePreview === "false") { + const noPreview = document.createElement("div") + noPreview.innerHTML = `Preview is disabled for this page.
` + return [noPreview] + } normalizeRelativeURLs(html, targetUrl) return [...html.getElementsByClassName("popover-hint")] })