mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-26 14:24:05 -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 {
|
import {
|
||||||
FullSlug,
|
FullSlug,
|
||||||
getFileExtension,
|
getFileExtension,
|
||||||
isAbsoluteFilePath,
|
isFullUrl,
|
||||||
|
isRelativeURL,
|
||||||
joinSegments,
|
joinSegments,
|
||||||
QUARTZ,
|
QUARTZ,
|
||||||
} from "../../util/path"
|
} from "../../util/path"
|
||||||
@ -153,9 +154,9 @@ export const CustomOgImages: QuartzEmitterPlugin<Partial<SocialImageOptions>> =
|
|||||||
let userDefinedOgImagePath = pageData.frontmatter?.socialImage
|
let userDefinedOgImagePath = pageData.frontmatter?.socialImage
|
||||||
|
|
||||||
if (userDefinedOgImagePath) {
|
if (userDefinedOgImagePath) {
|
||||||
userDefinedOgImagePath = isAbsoluteFilePath(userDefinedOgImagePath)
|
userDefinedOgImagePath = isRelativeURL(userDefinedOgImagePath)
|
||||||
? userDefinedOgImagePath
|
? `https://${baseUrl}/static/${userDefinedOgImagePath}`
|
||||||
: `https://${baseUrl}/static/${socialImage}`
|
: userDefinedOgImagePath
|
||||||
}
|
}
|
||||||
|
|
||||||
const generatedOgImagePath = isRealFile
|
const generatedOgImagePath = isRealFile
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user