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:
@@ -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
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ContentDetails } from "../../.quartz/plugins"
|
||||
import type { ContentDetails } from "../../.quartz/plugins"
|
||||
import { FullSlug, joinSegments } from "./path"
|
||||
|
||||
interface FileTrieData {
|
||||
|
||||
Reference in New Issue
Block a user