Test og:image property

This commit is contained in:
thiloho
2023-05-25 00:35:35 +02:00
parent 029222bb03
commit 99c8bd61d2
3 changed files with 8 additions and 5 deletions

View File

@@ -1,5 +1,7 @@
---
const { title, description } = Astro.props;
const { title, description, ogImage = "" } = Astro.props;
const imageUrl = new URL(ogImage, Astro.url.origin);
---
<head>
@@ -14,4 +16,5 @@ const { title, description } = Astro.props;
const storedTheme = localStorage.getItem("theme");
document.documentElement.className = storedTheme;
</script>
</head>
<meta property="og:image" content={imageUrl} />
</head>