Generating Custom OpenGraph Cards with Gatsby and the 11ty Screenshot Service
steele.blue·142w
Preview
Report Post

I made the sharable OpenGraph images on this site better by generating custom cards contextual to each post:

OpenGraph social card for blog post

The core concept is to create a sidecar page for each post that looks like an OpenGraph card, then take a snapshot of the page, and set it as the og:image meta tag on the original post.

There are a few Gatsby plugins that attempt to help, but they rely on Puppeteer to generate screenshots at build-time, which can slow down a build pretty significantly, and adds a heavy dependency to the toolchain.

The approach I took leverages Gatsby’s dynamic page generation, b…

Similar Posts

Loading similar posts...