refactor: update ogImage.src to ogImage

This commit is contained in:
satnaing
2023-01-30 20:57:35 +06:30
parent fc37b89953
commit 50af65b0b4
2 changed files with 3 additions and 5 deletions
+2 -4
View File
@@ -16,10 +16,8 @@ const { title, author, description, ogImage, pubDatetime, tags } = post.data;
const { Content } = await post.render();
const ogUrl = new URL(
ogImage?.src ? ogImage?.src : `${title}.svg`,
Astro.url.origin
).href;
const ogUrl = new URL(ogImage ? ogImage : `${title}.svg`, Astro.url.origin)
.href;
---
<Layout title={title} author={author} description={description} ogImage={ogUrl}>
+1 -1
View File
@@ -11,7 +11,7 @@ const posts = Object.values(postImportResult);
export function getStaticPaths() {
return posts
.filter(({ data }) => !data.ogImage?.src)
.filter(({ data }) => !data.ogImage)
.map(({ data }) => ({
params: { ogTitle: data.title },
}));