From 99c8bd61d2a342a6bd6f00af09debb938ec7891d Mon Sep 17 00:00:00 2001 From: thiloho <123883702+thiloho@users.noreply.github.com> Date: Thu, 25 May 2023 00:35:35 +0200 Subject: [PATCH] Test og:image property --- src/components/Head.astro | 7 +++++-- src/layouts/ArticleLayout.astro | 2 +- src/layouts/PageLayout.astro | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/components/Head.astro b/src/components/Head.astro index f6e9a18..75f76b5 100644 --- a/src/components/Head.astro +++ b/src/components/Head.astro @@ -1,5 +1,7 @@ --- -const { title, description } = Astro.props; +const { title, description, ogImage = "" } = Astro.props; + +const imageUrl = new URL(ogImage, Astro.url.origin); --- @@ -14,4 +16,5 @@ const { title, description } = Astro.props; const storedTheme = localStorage.getItem("theme"); document.documentElement.className = storedTheme; - + + \ No newline at end of file diff --git a/src/layouts/ArticleLayout.astro b/src/layouts/ArticleLayout.astro index cfa7eee..3311eeb 100644 --- a/src/layouts/ArticleLayout.astro +++ b/src/layouts/ArticleLayout.astro @@ -7,7 +7,7 @@ import TableOfContents from "../components/TableOfContents.svelte"; import PublicationDate from "../components/PublicationDate.astro"; --- - + {coverAlt} diff --git a/src/layouts/PageLayout.astro b/src/layouts/PageLayout.astro index 54f20be..4954eee 100644 --- a/src/layouts/PageLayout.astro +++ b/src/layouts/PageLayout.astro @@ -1,5 +1,5 @@ --- -const { title, description } = Astro.props; +const { title, description, ogImage } = Astro.props; import "open-props/style"; import "../styles/global.css"; @@ -13,7 +13,7 @@ import Footer from "../components/Footer.astro"; --- - +