mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 21:34:06 -06:00
fix(ogImage): update user-defined OG image path handling to support relative URLs
This commit is contained in:
parent
17cea6136a
commit
b7b53a923e
@ -4,7 +4,8 @@ import { unescapeHTML } from "../../util/escape"
|
||||
import {
|
||||
FullSlug,
|
||||
getFileExtension,
|
||||
isAbsoluteFilePath,
|
||||
isFullUrl,
|
||||
isRelativeURL,
|
||||
joinSegments,
|
||||
QUARTZ,
|
||||
} from "../../util/path"
|
||||
@ -153,9 +154,9 @@ export const CustomOgImages: QuartzEmitterPlugin<Partial<SocialImageOptions>> =
|
||||
let userDefinedOgImagePath = pageData.frontmatter?.socialImage
|
||||
|
||||
if (userDefinedOgImagePath) {
|
||||
userDefinedOgImagePath = isAbsoluteFilePath(userDefinedOgImagePath)
|
||||
? userDefinedOgImagePath
|
||||
: `https://${baseUrl}/static/${socialImage}`
|
||||
userDefinedOgImagePath = isRelativeURL(userDefinedOgImagePath)
|
||||
? `https://${baseUrl}/static/${userDefinedOgImagePath}`
|
||||
: userDefinedOgImagePath
|
||||
}
|
||||
|
||||
const generatedOgImagePath = isRealFile
|
||||
|
||||
Loading…
Reference in New Issue
Block a user