File conventions
Open Graph image response
Generate a bounded social image via next/og; inspect output and metadata. Source: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image
Formal Syntax & Structure
nextjs syntaxnextjs
app/opengraph-image.tsx → ImageResponseWorking Example
Example Snippetnextjs
import {ImageResponse} from 'next/og';export const alt='River Books reading guides';export const size={width:1200,height:630};export const contentType='image/png';export default function Image(){ return new ImageResponse(<div style={{display:'flex',width:'100%',height:'100%',background:'#153c39',color:'white',alignItems:'center',justifyContent:'center',fontSize:64}}>River Books</div>,size);}