OG Images in Docusaurus
New Docusaurus sites typically start with a placeholder social card (img/docusaurus-social-card.jpg). Every page shares it, so every link to your docs looks the same in Slack, on X or on LinkedIn. Docusaurus gives you two built-in levers: a site-wide default in themeConfig.image and a per-page image in front matter. It doesn't generate images for you.
This guide covers both levers, how Docusaurus fills in the other tags automatically, ways to get a unique image per doc, and the alternative: a hosted Unfurlkit URL per page.
Sources checked (21 Oct 2026): Docusaurus docs, "Search engine optimization (SEO)" (https://docusaurus.io/docs/seo), "Theme configuration" (meta image and metadata) (https://docusaurus.io/docs/api/themes/configuration), and the docs plugin front matter reference (https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs).
What Docusaurus already does
Per the SEO docs, Docusaurus automatically adds description, title, canonical links and other metadata to each Markdown page. Prefer front matter for description and keywords. Docusaurus applies the description to both description and og:description, which you'd otherwise have to declare twice. The official plugins (docs, blog, pages) all support the title, description, keywords and image front matter fields.
Docusaurus is a static site generator, so all of this is in the generated HTML. That's what crawlers read.
Step 1: A site-wide default with themeConfig.image
themeConfig.image sets the default image used for og:image and twitter:image. Per the theme configuration docs, the value:
- is relative to your site's
staticdirectory, - can't be an SVG,
- can be an external URL.
// docusaurus.config.js
export default {
themeConfig: {
image: 'img/social-card.png', // static/img/social-card.png
metadata: [{ name: 'twitter:card', content: 'summary_large_image' }],
},
};
themeConfig.metadata passes extra <meta> tags straight through. Setting twitter:card to summary_large_image here gets the large card on X for every page.
Replace the template's default card. Leaving docusaurus-social-card.jpg in place is one of the most common reasons docs links look generic.
Step 2: Per-page images with front matter
Each doc, blog post or page can set its own image, which becomes that page's og:image:
---
title: Authentication
description: Sign requests with your API key and handle token refresh.
image: /img/og/authentication.png
---
# Authentication
The docs plugin reference describes image as the "cover or thumbnail image that will be used as the <meta property="og:image"> in the <head>, enhancing link previews on social media and messaging platforms." Its own example uses an external URL (https://i.imgur.com/...), so absolute URLs work here.
For React pages under src/pages, use the @docusaurus/Head component:
Replace your-site.com with your own site.
import Layout from '@theme/Layout';
import Head from '@docusaurus/Head';
export default function Pricing() {
return (
<Layout title="Pricing" description="Plans and limits">
<Head>
<meta property="og:image" content="https://your-site.com/img/og/pricing.png" />
</Head>
{/* … */}
</Layout>
);
}
That's a React page file, not Markdown, so JSX is expected there.
Step 3: A unique image per doc
Front matter is static text, so Docusaurus can't compute an image from the title on its own. You have three practical options.
Option A: Make images by hand
Design a card per important page and reference it in front matter. This is fine for a dozen landing-style docs and impractical for hundreds.
Option B: Generate files before the build
Write a small script that runs before docusaurus build. It reads each doc's title, renders a PNG (for example with Satori plus a PNG converter, or a headless browser), saves it under static/img/og/, and writes the path into the doc's image front matter. You own the renderer, fonts and build time, and the generated files end up in your repo or build output.
Community plugins exist for this too. They're not part of Docusaurus, so check each one's maintenance and compatibility with your Docusaurus version before you adopt it.
Option C: Write a URL, not a file
Use the same pre-build script idea, but instead of rendering a PNG, write a hosted image URL into front matter. Nothing gets rendered at build time.
Step 3 (alternative): One URL with Unfurlkit
An Unfurlkit URL is an image URL built from the title. You can write it by hand:
---
title: Authentication
description: Sign requests with your API key and handle token refresh.
image: https://unfurlkit.com/v1/basic.png?title=Authentication&subtitle=My%20Docs&theme=dark
---
Or fill it in for every doc with a script (Node 18+, using gray-matter):
// scripts/og-front-matter.mjs
import { readFile, writeFile } from 'node:fs/promises';
import { globSync } from 'node:fs'; // Node 22+; use the "glob" package on older Node
import matter from 'gray-matter';
const ogUrl = (title) =>
'https://unfurlkit.com/v1/basic.png?' +
new URLSearchParams({ title: title || 'My Docs', subtitle: 'My Docs', theme: 'dark' }).toString();
for (const file of globSync('docs/**/*.md')) {
const doc = matter(await readFile(file, 'utf8'));
const title = doc.data.title || doc.content.match(/^#\s+(.+)$/m)?.[1];
if (doc.data.image && !doc.data.image.startsWith('https://unfurlkit.com/')) continue; // keep hand-made images
doc.data.image = ogUrl(title);
await writeFile(file, matter.stringify(doc.content, doc.data));
}
Run it before docusaurus build, or once and commit the result. Re-running updates images when titles change. It skips .mdx files on purpose: rewriting MDX with gray-matter is usually fine, but review the diff the first time.
title is required and must be non-empty. The basic template also takes subtitle (your product or docs name works well), theme (light or dark) and accent (6-digit hex, no #). See the basic template.
Plans. Every image URL needs your key. A Free key gets 10 renders in total (no monthly reset), with a small "unfurlkit" watermark, and needs no card. Pro is $9/mo or $90/yr, with 10,000 renders a month, no watermark, and custom fonts (Inter, Roboto, Playfair Display, JetBrains Mono) and logo. Pro URLs add your public key k and a signature s.
Signing. The script runs in Node on your machine or in CI, so it can sign there. Swap ogUrl for the signedOgUrl snippet from Signing Pro URLs, reading the keys from environment variables. The secret never appears in your docs. Only the public key and signature do.
A render is counted only when a unique image is generated and wasn't already cached. Shares and cache hits don't count. Over the limit, images keep rendering. On a signed Free key, images already made keep showing, and new ones get a plain version (your title on the basic card, with the small mark) that doesn't count. Upgrade to Pro for more renders. On Pro there's no hard stop and no overage charge, and we may contact you about your usage. Upgrade to Pro to remove watermarks from all your images. See pricing.
Which option should you use?
| Situation | Best fit |
|---|---|
| Small docs site, a few key pages | A good themeConfig.image plus hand-made images |
| Custom-designed cards, and you'll maintain a renderer | Pre-build generation (Option B) |
| Many docs, no rendering, a clean standard card | Unfurlkit URLs in front matter |
| Right-to-left docs (Arabic, Hebrew) | Option B with suitable fonts (Unfurlkit doesn't support RTL yet) |
Debugging checklist
- Still seeing the default card? Check the built HTML in
build/forog:image. A page'simagefront matter should overridethemeConfig.image. - Relative image path? Front matter and
themeConfig.imagepaths are resolved by Docusaurus. If you write tags yourself withHead, use absolute URLs. - SVG card?
themeConfig.imagecan't be an SVG, and most platforms don't render SVG previews anyway. Use PNG or JPEG. - Small card on X? Add
twitter:card=summary_large_imageviathemeConfig.metadata. - Unfurlkit 400? Missing or empty
title, or an invalid param. - Run the Free OG Image Checker to preview X, LinkedIn, Facebook, WhatsApp, Slack, Discord and iMessage.
See also OG image not showing.
FAQ
Which languages and scripts are supported? Right-to-left scripts such as Arabic and Hebrew aren't supported yet at launch.
Does image work for blog posts too?
Yes. The SEO docs say all official plugins support image front matter.
Can I set the image for a whole docs section? Not with a built-in option. Use a script to write front matter per file, as above.
Does noindex affect social previews?
noindex controls search indexing. Social crawlers read the tags separately. Docusaurus's sitemap plugin also skips pages with a noindex robots meta tag.
Will Unfurlkit URLs slow down my docs?
No. The image URL is only in <meta> tags. Browsers don't load it when people read your docs. Only crawlers fetch it, and only when a link is shared.
Does this work with versioned docs and i18n?
Yes. Versioned and translated docs are Markdown files too, so the same script can process versioned_docs/ and i18n/. For translated titles, keep in mind the RTL limitation above.
What size should the image be? 1200×630. See OG image size.
Summary
Replace the default social card in themeConfig.image, add summary_large_image, and give important pages their own image. For a unique card on every doc without a renderer, write an Unfurlkit URL into front matter with a small script.
See Unfurlkit pricing · Check any page with the Free OG Image Checker.