Next.js · Middle · Question 46 of 75
What is opengraph-image.tsx useful for?
- ✓Correct answer: Generating the route's OG image from JSX at build time or on request
- 2Optimizing all images on the page for social media sharing
- 3Adding a watermark to all of the route's images
Explanation
By convention the file returns an ImageResponse with JSX markup - Next.js turns it into a PNG and adds the necessary <meta> tags. Handy for article previews with a title. In Next.js 16, params in such files is a promise too.