diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx index 946231ffe..d4a4944bd 100644 --- a/quartz/components/Head.tsx +++ b/quartz/components/Head.tsx @@ -131,13 +131,15 @@ export default (() => { const baseDir = fileData.slug === "404" ? path : pathToRoot(fileData.slug!) const iconPath = joinSegments(baseDir, "static/icon.png") - // TODO: use default image if undefined + const useDefaultOgImage = filePath === undefined const ogImageDefaultPath = `https://${cfg.baseUrl}/static/og-image.png` - const ogImagePath = `https://${cfg.baseUrl}/${imageDir.replace( + const ogImageGeneratedPath = `https://${cfg.baseUrl}/${imageDir.replace( "public/", "", )}/${filePath}.${extension}` + const ogImagePath = useDefaultOgImage ? ogImageDefaultPath : ogImageGeneratedPath + return (