feat: use default og image if no path exists

This commit is contained in:
Ben Schlegel 2023-09-23 13:45:13 +02:00
parent 91a0c3e0b4
commit b207477248
No known key found for this signature in database
GPG Key ID: 8BDB8891C1575E22

View File

@ -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 (
<head>
<title>{title}</title>