← buildlog og

Dynamic OG images for Docusaurus

Set the default social card in docusaurus.config.js, and per-doc images with the image front matter field. The API returns a 1200×630 PNG, cached at the edge.

// docusaurus.config.js
themeConfig: {
  image: 'https://og.sadana.app/api/og?title=My%20Docs&subtitle=Guides%20and%20API%20reference&site=docs.example.com',
}
// per page (front matter in an .md file):
// image: https://og.sadana.app/api/og?title=Getting%20started

Docusaurus accepts absolute URLs for image, so no static file is needed.

Preview

Example OG image for Docusaurus

Parameters

title     required, up to 200 chars
subtitle  optional
site      optional footer text
theme     light | dark (Pro)
key       Pro license key (removes watermark)

Check it

After deploying, paste a URL into a card validator (e.g. opengraph.xyz) or share it in a private Slack/Discord channel. Social crawlers cache images, so change the URL (e.g. add &v=2) to force a refresh.

Try the generator

Other frameworks

Next.js · Astro · Hugo · WordPress · Ghost · SvelteKit · Nuxt · Eleventy (11ty) · Jekyll · Docusaurus · plain HTML