fix: get og image url correctly

This commit is contained in:
tanishqmanuja
2023-09-20 15:33:51 +05:30
committed by Sat Naing
parent b03b722369
commit 7f3edbdecd
2 changed files with 3 additions and 4 deletions
+2 -4
View File
@@ -18,10 +18,8 @@ const { title, author, description, ogImage, canonicalURL, pubDatetime, tags } =
const { Content } = await post.render();
const ogUrl = new URL(
ogImage ? ogImage.src : `${post.slug}.png`,
Astro.url.origin
).href;
const ogImageUrl = typeof ogImage === "string" ? ogImage : ogImage?.src;
const ogUrl = new URL(ogImageUrl ?? `${post.slug}.png`, Astro.url.origin).href;
---
<Layout