All articles

Dynamic Open Graph Images with Vercel Edge Functions

Jean-Eudes AssogbaJune 29, 20251 min read
Dynamic Open Graph Images with Vercel Edge Functions

Dynamic Open Graph Images with Vercel Edge Functions

Open Graph images boost social sharing. Generate them dynamically at the edge for personalization.

Setup

npm install @vercel/og

Edge Route

  • Uses Edge runtime (export const runtime = 'edge').
  • Renders JSX to image with ImageResponse.
  • Parameters: title, locale.

Advantages

  • Custom OG per page.
  • No backend; fully CDN-backed.
  • Fast generation and caching.