Include an image's absolute URL in the ImageMetaData when images are processed in Content Collections to allow @vercel/og to render Astro's images #975
RPDeshaies
started this conversation in
Proposal
Replies: 1 comment 3 replies
-
Hello! You can get a full absolute path fairly easily by using |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Astro Info
If this issue only occurs in one browser, which browser is a problem?
N/A
Describe the Bug
Once processed by Astro, Images in Content Collection have the following form.
Which is perfect for when images are rendered in the app itself.
In my application, I'm using the
@vercel/og
package to generate open graph social media images for pages of the site using Astro Endpoints. The issue is that if I try to render a normal<img/>
tag and use theimage.src
I get the following error from@vercel/og
What's the expected result?
I know this is a very specific issue with Vercel OG but since Astro doesn't provide a baked in way of generating such images, I was wondering if it would be possible to include the raw and absolute URL of the source image in the ImageMetaData so that it could be used in such scenarios.
I included a Stackblitz below where the
/og.png
Endpoint works if you comment out the<img/>
tag but crashes if you don't.Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-vyt8ws?file=src%2Fpages%2F_renderOgImage.tsx
Participation
Beta Was this translation helpful? Give feedback.
All reactions