mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
refactor: update ogImage.src to ogImage
This commit is contained in:
@@ -16,10 +16,8 @@ const { title, author, description, ogImage, pubDatetime, tags } = post.data;
|
|||||||
|
|
||||||
const { Content } = await post.render();
|
const { Content } = await post.render();
|
||||||
|
|
||||||
const ogUrl = new URL(
|
const ogUrl = new URL(ogImage ? ogImage : `${title}.svg`, Astro.url.origin)
|
||||||
ogImage?.src ? ogImage?.src : `${title}.svg`,
|
.href;
|
||||||
Astro.url.origin
|
|
||||||
).href;
|
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout title={title} author={author} description={description} ogImage={ogUrl}>
|
<Layout title={title} author={author} description={description} ogImage={ogUrl}>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const posts = Object.values(postImportResult);
|
|||||||
|
|
||||||
export function getStaticPaths() {
|
export function getStaticPaths() {
|
||||||
return posts
|
return posts
|
||||||
.filter(({ data }) => !data.ogImage?.src)
|
.filter(({ data }) => !data.ogImage)
|
||||||
.map(({ data }) => ({
|
.map(({ data }) => ({
|
||||||
params: { ogTitle: data.title },
|
params: { ogTitle: data.title },
|
||||||
}));
|
}));
|
||||||
|
|||||||
Reference in New Issue
Block a user