Your Social Previews Are Static Screenshots. Generate Open Graph Images From Code.
Every link your team shares on LinkedIn, Slack, or X gets judged by its preview card before anyone reads a word. Most marketing sites still ship one generic logo image for every page, or worse, nothing at all, so the platform scrapes a random hero crop. That is a silent tax on every share, and it is fixable with about fifty lines of code.
The position: Open Graph images should be generated from page data at build or request time, not exported by hand from a design tool. Templates, not screenshots. Once the image is code, it stays correct when titles change, scales to thousands of pages, and costs nothing per asset.
Why Hand-Made Share Images Always Rot
A designer exports a 1200 by 630 PNG for the launch post. Three weeks later the title changes, the category label is renamed, and the image still says the old thing. Multiply that by every page and you get a site where previews contradict the headline they sit under.
The deeper problem is coverage. Hand-made images exist for the pages someone cared about on launch day. Docs, glossary entries, case studies, and every post written after the designer moved on fall back to the default. Those long-tail pages are exactly where shared links come from in Slack channels and sales emails.
Generated images fix both failures. The title, category, and author come from the same source as the page, so they cannot drift. Coverage is 100 percent by construction.
The Stack: Satori, Resvg, and a Route Handler
You do not need a headless browser. Satori, the library behind Vercel's OG image tooling, converts a JSX-style layout into SVG, and Resvg turns that SVG into a PNG. It runs in a Node build step, an edge function, or a serverless route.
The pattern has four parts:
- A template component that takes
title,category, anddateand lays out a 1200 by 630 canvas with your brand font and colors. - A route such as
/og/[slug].pngthat looks up the page data and renders the template. - A meta tag on every page pointing at that route:
og:image,og:image:width,og:image:height, andtwitter:cardset tosummary_large_image. - A cache header of one year with the slug and a content hash in the URL, so a title change busts the cache and nothing else does.
Load your font file explicitly. Satori does not read system fonts, and the most common failure is a preview that renders in a fallback typeface. Subset the font to the glyphs you use and the bundle stays small.
For static sites, skip the route and generate PNGs at build time into /public/og/. For sites with thousands of pages, render on first request and let your CDN hold the result.
Three Ways to Produce Open Graph Images
| Approach | Coverage | Stays Accurate | Cost Per Image |
|---|---|---|---|
| Hand-exported from design tool | Launch pages only | No, drifts on every edit | Designer time |
| Screenshot service of the live page | All pages | Yes, but crops are unpredictable | Per-request fees |
| Template rendered with Satori | All pages | Yes, same data as the page | Near zero |
Design Rules That Survive Small Screens
A preview card is often rendered at 300 pixels wide on a phone. Design for that, not for your monitor.
Keep the title under 70 characters and set it at 64 pixels or larger. Truncate with an ellipsis in code rather than letting text overflow. Use two colors plus white or black, because gradients and thin lines turn to mud after platform compression. Put the logo in a corner at a size you can still recognize at thumbnail scale. Leave a 60 pixel safe margin, since LinkedIn and some chat apps crop edges differently.
One more rule: encode the content type. A small pill reading "Guide," "Case Study," or "Changelog" tells a scroller what they are about to click. That label costs one field in your template and measurably sets expectations before the click.
Ship It and Test It
Rollout takes an afternoon. Build the template, wire the route, add the meta tags in your layout so every page inherits them, and deploy. Then verify with the tools platforms actually use: the LinkedIn Post Inspector, the Facebook Sharing Debugger, and a plain curl -I on the image URL to confirm a 200 status, image/png, and a long cache lifetime.
Add a CI check as well. Crawl your sitemap, fetch each page's og:image, and fail the build if any return a non-200 status or an image that is not 1200 by 630. Broken previews are invisible to you and obvious to everyone who receives the link.
Open Graph Image Launch Checklist
- Template renders title, category, and date at 1200 by 630 with a 60 pixel safe margin
- Brand font is loaded explicitly and subset to used glyphs
- Every page emits og:image, og:image:width, og:image:height, and twitter:card summary_large_image
- Image URLs include a content hash and ship with a one-year cache header
- Titles over 70 characters are truncated in code, not by the platform
- LinkedIn Post Inspector and Facebook Sharing Debugger show the new card
- CI crawls the sitemap and fails on any missing or wrong-size og:image
Treat share previews as part of the page, not decoration on top of it. When the image is generated from the same data as the headline, every shared link makes the same strong first impression, and nobody on your team ever opens a design tool to fix a preview again.
Tags
LETSGROW Dev Team
Marketing Technology Experts
Ready to Apply This Insight?
Schedule a strategy call to map these ideas to your architecture, data, and operating model.
Schedule Strategy Call