mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
feat: use new og images in layout
This commit is contained in:
@@ -22,7 +22,7 @@ const {
|
|||||||
} = Astro.props;
|
} = Astro.props;
|
||||||
|
|
||||||
const socialImageURL = new URL(
|
const socialImageURL = new URL(
|
||||||
ogImage ? ogImage : SITE.ogImage,
|
ogImage ?? SITE.ogImage ?? "og.png",
|
||||||
Astro.url.origin
|
Astro.url.origin
|
||||||
).href;
|
).href;
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ const { title, author, description, ogImage, canonicalURL, pubDatetime, tags } =
|
|||||||
const { Content } = await post.render();
|
const { Content } = await post.render();
|
||||||
|
|
||||||
const ogImageUrl = typeof ogImage === "string" ? ogImage : ogImage?.src;
|
const ogImageUrl = typeof ogImage === "string" ? ogImage : ogImage?.src;
|
||||||
const ogUrl = new URL(ogImageUrl ?? `${post.slug}.png`, Astro.url.origin).href;
|
const ogUrl = new URL(
|
||||||
|
ogImageUrl ?? `/posts/${slugifyStr(title)}.png`,
|
||||||
|
Astro.url.origin
|
||||||
|
).href;
|
||||||
---
|
---
|
||||||
|
|
||||||
<Layout
|
<Layout
|
||||||
|
|||||||
+1
-1
@@ -3,7 +3,7 @@ export type Site = {
|
|||||||
author: string;
|
author: string;
|
||||||
desc: string;
|
desc: string;
|
||||||
title: string;
|
title: string;
|
||||||
ogImage: string;
|
ogImage?: string;
|
||||||
lightAndDarkMode: boolean;
|
lightAndDarkMode: boolean;
|
||||||
postPerPage: number;
|
postPerPage: number;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user