og:image meta tag. This guide shows how to generate OG images programmatically — define the image as a component, render to PNG at build time.
How it works
The approach is the same one Next.js uses under the hood with@vercel/og:
- Satori renders a component (JSX-like object) to SVG — supports flexbox, text, images, gradients
- resvg converts the SVG to a PNG bitmap
- The PNG is saved to
public/and referenced inog:imagemeta tags
Setup
Installsatori and @resvg/resvg-js:
Write the OG component
Create a generation script atscripts/generate-og.ts. The “component” is a plain object tree — same structure as React elements, but no framework needed:
Component patterns
Embedding images
Use SVGs as data URIs in<img> tags:
Background gradients
Satori supportsradialGradient and linearGradient via CSS:
Bottom bar with badge + URL
Satori limitations
Satori renders a subset of CSS. Key things to know:| Supported | Not supported |
|---|---|
Flexbox (display: flex) | Grid (display: grid) |
border-radius, box-shadow | filter, backdrop-filter |
background (gradients, colors) | clip-path |
position: absolute/relative | transform (limited) |
| Google Fonts (ttf/woff) | Local system fonts, woff2 |
<img> with data URIs or URLs | <svg> inline (use <img> with data URI) |
Satori doesn’t support woff2 fonts. When loading from Google Fonts, use the Googlebot user agent to get ttf format:
{ headers: { 'User-Agent': 'Mozilla/5.0 (compatible; Googlebot/2.1)' } }.Adding OG meta tags
Reference the generated image in your HTML<head>. In a static site build script, inject these after the <title>:
Integrating with the build
Call the OG generation script from your build script so images are always up to date:Future: @vertz/og
We plan to ship OG image generation as a framework-level feature. The envisioned API:
@vertz/theme-shadcn, and integrate with vertz build to generate images automatically. See the tracking issue for progress.
Static Sites
Full guide on deploying static Vertz sites
Styling
Theme tokens and the css() API