Metadata

Twitter social card file

Use the twitter-image filename for a separate social card. Export alt, size and contentType for generated images. Keep rendering bounded and avoid external font or image fetches in offline examples. Source: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/opengraph-image. Documentation-reviewed illustrative draft; installed declarations and runtime not verified.

Formal Syntax & Structure

nextjs syntaxnextjs
app/twitter-image.tsx or app/twitter-image.png

Working Example

Example Snippetnextjs
// app/twitter-image.tsximport {ImageResponse} from 'next/og';export const alt='River Books reading room';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%',alignItems:'center',justifyContent:'center',background:'white',fontSize:56}}>Reading room</div>,size);}
Next.js Reference