Docusaurus generates static HTML for every URL in your site, which gives search engine crawlers a clean, indexable page without any client-side rendering overhead. On top of that foundation, Docusaurus provides several layers of SEO control — from per-page frontmatter to site-wide metadata, sitemaps, and structured data.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/facebook/docusaurus/llms.txt
Use this file to discover all available pages before exploring further.
Page-level metadata via frontmatter
Every Markdown and MDX page can define its owntitle, description, keywords, and image fields in frontmatter. Docusaurus applies these to both the HTML <meta> tags and the corresponding Open Graph (og:) properties automatically:
docs/getting-started.md
The
title, description, keywords, and image frontmatter fields are supported by all three official content plugins: docs, blog, and pages. Check each plugin’s API reference for any additional plugin-specific frontmatter.Global site metadata
Metadata that should appear on every page belongs indocusaurus.config.js. Use themeConfig.metadata for <meta> tags and headTags for arbitrary <head> elements:
docusaurus.config.js
Custom <head> tags per page
For per-page head customization in MDX files, embed a <head> block directly in your Markdown:
docs/my-page.mdx
src/pages/*.jsx), use the <Head> component from @docusaurus/Head:
src/pages/my-page.jsx
Open Graph and Twitter card support
Open Graph and Twitter Card tags control how your pages are displayed when shared on social media. Set them through frontmatter or the<head> block.
- Via frontmatter (recommended)
image to og:image and twitter:image automatically.Twitter card tags can also be set globally in
themeConfig.metadata so every page in your site gets a default card type without per-page configuration.Sitemap plugin
@docusaurus/plugin-sitemap automatically generates sitemap.xml after a production build. The file is available at https://example.com/[baseUrl]/sitemap.xml and helps search engine crawlers discover all of your pages.
The plugin is included in @docusaurus/preset-classic and enabled by default. Configure it through the preset:
docusaurus.config.js
- npm
- yarn
docusaurus.config.js
robots.txt
Place arobots.txt file in your static/ directory. Docusaurus copies everything in static/ to the build output root, so the file will be served at /robots.txt.
To allow all crawlers to index all pages:
static/robots.txt
static/robots.txt
Canonical URLs
Docusaurus automatically adds a<link rel="canonical"> tag to each page pointing to its own URL. This prevents duplicate content penalties when the same content is accessible at multiple URLs (for example, with and without a trailing slash, or across different domains).
You can override the canonical URL for a specific page using frontmatter:
<link rel="alternate" hreflang="..."> tags so search engines serve the correct language version to users in each locale.
Structured data
Search engines use structured data (JSON-LD) to generate rich results in SERPs. Inject it viaheadTags in your config for global structured data, or via the <head> block / <Head> component for page-level data:
docusaurus.config.js
SEO checklist
Every page has a unique title and description
Every page has a unique title and description
Set
title and description in frontmatter for each Markdown page. For React pages, pass them as props to the <Layout> component.Social sharing images are configured
Social sharing images are configured
Sitemap is generated
Sitemap is generated
Confirm
sitemap.xml appears in your production build output and submit it to Google Search Console.robots.txt is present
robots.txt is present
Place a
robots.txt in static/ appropriate to your environment (allow for production, restrict for staging).noindex pages are excluded from the sitemap
noindex pages are excluded from the sitemap
Pages with
<meta name="robots" content="noindex"> are automatically excluded from the generated sitemap.URLs are human-readable
URLs are human-readable
Docusaurus uses file names as URL slugs by default. Override with the
slug frontmatter field when you need a different URL.
imagein frontmatter or addog:image/twitter:imagemeta tags. Use an image at least 1200×630 pixels for best results on Twitter and LinkedIn.