feat: use new og images in layout

This commit is contained in:
tanishqmanuja
2023-09-20 15:55:32 +05:30
committed by Sat Naing
parent 300d014fd7
commit 88d9343ab5
3 changed files with 6 additions and 3 deletions
+1 -1
View File
@@ -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;
--- ---
+4 -1
View File
@@ -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
View File
@@ -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;
}; };