GitHub's Open Graph Images Are Rendered HTML

GitHub has published an explanation of how its new social media preview images are produced. The custom Open Graph image service is a small Node.js application, according to the company.

It works in three stages, as described on The GitHub Blog:

  • The app pulls data through the GitHub GraphQL API.
  • That data is used to generate HTML from a template.
  • The HTML is piped to Puppeteer, which "takes a screenshot" of the rendered page.

"[…] our custom Open Graph image service is a little Node.js app that uses the GitHub GraphQL API to collect data, generates some HTML from a template, and pipes it to Puppeteer to 'take a screenshot' of that HTML."

Jason Etcovich, The GitHub Blog, "A framework for building Open Graph images"

Building templated images out of HTML and CSS is a satisfying approach and a fitting way to produce social media images. For anyone doing it at GitHub's scale, the write-up includes a few tricks for speeding the process up.