fix: decouple Head.tsx from og-image plugin import (#2495)

Remove unconditional import of CustomOgImagesEmitterName from
.quartz/plugins in Head.tsx. This caused builds to fail when the
og-image plugin was not listed in quartz.config.yaml, violating the
plugin system's opt-in contract.

The fix inlines the emitter name string constant at the usage site.

Also convert the ContentDetails import in fileTrie.ts to
`import type` since it is only used in a type position.
This commit is contained in:
Emile Bangma
2026-07-23 15:30:37 +02:00
committed by GitHub
parent 555b2ba838
commit 581f6707da
2 changed files with 3 additions and 5 deletions
+2 -4
View File
@@ -4,7 +4,7 @@ import { CSSResourceToStyleElement, JSResourceToScriptElement } from "../util/re
import { googleFontHref, googleFontSubsetHref } from "../util/theme"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { unescapeHTML } from "../util/escape"
import { CustomOgImagesEmitterName } from "../../.quartz/plugins"
export default (() => {
const Head: QuartzComponent = ({
cfg,
@@ -31,9 +31,7 @@ export default (() => {
const socialUrl =
fileData.slug === "404" ? url.toString() : joinSegments(url.toString(), fileData.slug!)
const usesCustomOgImage = ctx.cfg.plugins.emitters.some(
(e) => e.name === CustomOgImagesEmitterName,
)
const usesCustomOgImage = ctx.cfg.plugins.emitters.some((e) => e.name === "CustomOgImages")
const ogImageDefaultPath = `https://${cfg.baseUrl}/static/og-image.png`
const coreStylesheet = css[0]?.content