Next.js Discord

Discord Forum

Use image from opengrah-image.tsx in page directly

Unanswered
Cape lion posted this in #help-forum
Open in Discord
Avatar
Cape lionOP
Hey there, I was wondering: Is there are way to use the image generated from opengraph-image.tsx in a layout as part of the regular page content, e.g. display it with an <Image/> tag?

I'd like to not have the logic for generating the images in multiple places.

2 Replies

Avatar
you can abstract the logic to generate the image for you to it's own function. Like that you only need to call the same function in both places and you get exactly the same content, while writing the function itself only once
Avatar
@Cape lion solved?