feat: add frontmatter aliases for cover image

This commit is contained in:
Ben Schlegel 2024-01-26 22:29:30 +01:00
parent be5f060bc1
commit fe282292ce
No known key found for this signature in database
GPG Key ID: 8BDB8891C1575E22

View File

@ -120,7 +120,11 @@ export default (() => {
let ogImagePath = useDefaultOgImage ? ogImageDefaultPath : ogImageGeneratedPath
// TODO: could be improved to support external images in the future
const frontmatterImgUrl = fileData.frontmatter?.socialImage
// Handle aliases (socialImage, image and cover are supported to ensure obsidian publish support)
const frontmatterImgUrl =
fileData.frontmatter?.socialImage ??
fileData.frontmatter?.image ??
fileData.frontmatter?.cover
if (frontmatterImgUrl) {
ogImagePath = `https://${cfg.baseUrl}/static/${frontmatterImgUrl}`
}