Skip to content

Instantly share code, notes, and snippets.

@officialrajdeepsingh
Last active August 20, 2026 17:26
Show Gist options
  • Select an option

  • Save officialrajdeepsingh/db41bc1382aa3db41d3aef349997e102 to your computer and use it in GitHub Desktop.

Select an option

Save officialrajdeepsingh/db41bc1382aa3db41d3aef349997e102 to your computer and use it in GitHub Desktop.
OG images with Takumi
Feature Static app/opengraph-image.tsx Dynamic app/blog/[slug]/opengraph-image.tsx API app/og/route.tsx
Approach Next.js metadata convention Next.js metadata convention Custom Route/API Handler
Location app/opengraph-image.tsx app/blog/[slug]/opengraph-image.tsx app/og/route.tsx
Type Static Dynamic API endpoint
Scope Site-wide default OG image Individual blog posts Reusable image generator
Parameters None required Route parameters (slug) Query parameters (?title=...)
OG meta tags Added automatically Added automatically Configure manually
Caching Handled by Next.js Handled by Next.js Configure as needed
Best for Default/site-wide image Blog post images Flexible image generation
Main benefit Simple and automatic Generate unique images for each route Build the OG image generator once and reuse it across your entire Next.js application with different parameters.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment