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 { googleFontHref, googleFontSubsetHref } from "../util/theme"
import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types" import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import { unescapeHTML } from "../util/escape" import { unescapeHTML } from "../util/escape"
import { CustomOgImagesEmitterName } from "../../.quartz/plugins"
export default (() => { export default (() => {
const Head: QuartzComponent = ({ const Head: QuartzComponent = ({
cfg, cfg,
@@ -31,9 +31,7 @@ export default (() => {
const socialUrl = const socialUrl =
fileData.slug === "404" ? url.toString() : joinSegments(url.toString(), fileData.slug!) fileData.slug === "404" ? url.toString() : joinSegments(url.toString(), fileData.slug!)
const usesCustomOgImage = ctx.cfg.plugins.emitters.some( const usesCustomOgImage = ctx.cfg.plugins.emitters.some((e) => e.name === "CustomOgImages")
(e) => e.name === CustomOgImagesEmitterName,
)
const ogImageDefaultPath = `https://${cfg.baseUrl}/static/og-image.png` const ogImageDefaultPath = `https://${cfg.baseUrl}/static/og-image.png`
const coreStylesheet = css[0]?.content const coreStylesheet = css[0]?.content
+1 -1
View File
@@ -1,4 +1,4 @@
import { ContentDetails } from "../../.quartz/plugins" import type { ContentDetails } from "../../.quartz/plugins"
import { FullSlug, joinSegments } from "./path" import { FullSlug, joinSegments } from "./path"
interface FileTrieData { interface FileTrieData {