opengraph-image.tsx
A special file in a route folder that generates or provides the route's Open Graph image, with Next.js adding the meta tags automatically.
In more detail
As a .tsx file it returns an ImageResponse built from JSX; as .png or .jpg it is used as is. Generated images are statically optimised and cached unless they use dynamic data.
Related terms
- ImageResponse — A Next.js class from next/og that turns JSX and a subset of CSS into a PNG image response.
- Open Graph — A set of meta tags, started by Facebook, that tells social sites what title, description and image to show when a link is shared.
Taught in
- Metadata API: Dynamic OpenGraph & Head Management — Next.js 15 & Modern App Router Architecture