Is there a way to know the URL for opengraph-image.tsx?
Unanswered
Nile Crocodile posted this in #help-forum
Nile CrocodileOP
I am creating a
In every single page so that I can get the image created from
constructMetadata so that I don't have to repeat some of the defaults for my website. However, I have an opengraph-image.tsx at the root level that generates an image for pretty much every page except my articles as it has another opengraph-image.tsx . It's kind of annoying to have to doexport async function generateMetadata({}, parent: ResolvingMetadata): Promise<Metadata> {
const defaultMetadata = constructMetadata({
title: 'About Redshirt Sports - Meet the Team Behind College Football Coverage',
description:
"Learn about Redshirt Sports and our team's dedication to covering FCS, FBS, D2, and D3 football. Discover our mission and the experts behind the news.",
canonical: '/about',
})
const previousImages = (await parent).openGraph?.images || []
return {
...defaultMetadata,
openGraph: {
...defaultMetadata.openGraph,
images: [...previousImages],
url: '/about',
},
twitter: {
...defaultMetadata.twitter,
card: 'summary_large_image',
images: [...previousImages],
},
}
}In every single page so that I can get the image created from
opengraph-image.tsx. Is there a better way to handle metadata?