diff --git a/quartz/components/Head.tsx b/quartz/components/Head.tsx index 48bb0c84c..deda84745 100644 --- a/quartz/components/Head.tsx +++ b/quartz/components/Head.tsx @@ -129,7 +129,12 @@ export default (() => { const slug = fileData.filePath const filePath = slug?.replaceAll("/", "-") const title = fileData.frontmatter?.title ?? "Untitled" - const description = fileData.description?.trim() ?? "No description provided" + + // Get file description (priority: frontmatter > fileData > default) + let description = fileData.description?.trim() ?? "No description provided" + if (fileData.frontmatter?.socialDescription) { + description = fileData.frontmatter.socialDescription + } if (cfg.generateSocialImages) { // Generate folders for social images (if they dont exist yet) @@ -158,7 +163,13 @@ export default (() => { // Use default og image if filePath doesnt exist (for autogenerated paths with no .md file) const useDefaultOgImage = filePath === undefined || !cfg.generateSocialImages - const ogImagePath = useDefaultOgImage ? ogImageDefaultPath : ogImageGeneratedPath + // Path to og/social image (priority: frontmatter > generated image (if enabled) > default image) + let ogImagePath = useDefaultOgImage ? ogImageDefaultPath : ogImageGeneratedPath + + const frontmatterImgUrl = fileData.frontmatter?.socialImageUrl + if (frontmatterImgUrl) { + ogImagePath = `https://${cfg.baseUrl}/static/${frontmatterImgUrl}` + } return (
@@ -174,7 +185,7 @@ export default (() => { - +