
How to auto-generate OG images when you publish a new blog post
How to Auto-Generate OG Images When You Publish a New Blog Post Every blog post needs an OG image — the preview card that shows up when someone shares your link on Twitter, LinkedIn, or Slack. Most teams either skip it (broken gray preview) or do it manually in Figma (doesn't scale). The automated alternatives — Satori, @vercel/og , Puppeteer-based generators — all require either a Node.js Edge runtime or a headless browser. Here's the simpler path: one API call, image returned. The pattern publish post → webhook/build hook fires → fetch post data → render HTML card → PageBolt OG image → upload to CDN → update post metadata Ghost CMS webhook // server.js — receives Ghost's post.published webhook import express from " express " ; import { uploadToCDN } from " ./storage.js " ; const app = express (); app . use ( express . json ()); app . post ( " /webhooks/ghost " , async ( req , res ) => { const { post } = req . body ; if ( ! post ?. current ) return res . json ({ ok : true }); const {
Continue reading on Dev.to Webdev
Opens in a new tab




