From 3431077897459f5276eefea932da55703ff1629c Mon Sep 17 00:00:00 2001 From: Ricardo Tribaldos <579671+tribal2@users.noreply.github.com> Date: Wed, 27 Mar 2024 17:03:27 -0500 Subject: [PATCH] Move social image to /src/images to allow Astro auto optimization --- src/components/Meta.astro | 4 +++- src/data_files/constants.ts | 3 +++ {public => src/images}/social.png | Bin 3 files changed, 6 insertions(+), 1 deletion(-) rename {public => src/images}/social.png (100%) diff --git a/src/components/Meta.astro b/src/components/Meta.astro index f0ae831..f6fd70c 100644 --- a/src/components/Meta.astro +++ b/src/components/Meta.astro @@ -20,7 +20,9 @@ const URL = `${Astro.site}`; // Set the website URL in astro.config.mjs const author = SITE.author; const ogTitle = OG.title; const ogDescription = OG.description; -const socialImage: string = `${Astro.site}/social.png`; // Set the path for the social media image +const socialImageRes = await getImage({ src: OG.image, width: 1200, height: 600 }); +const socialImage = Astro.url.origin + socialImageRes.src; // Get the full URL of the image (https://stackoverflow.com/a/9858694) + ---