On-site search (the ⌘K palette) helps readers who are already on your docs. This page covers search engine indexing (metadata, sitemap.xml, and robots.txt for Google and other crawlers). See Search for reader-facing search and Search engine indexing for how crawler files are built.
Before you begin
- A branch preview or production URL (local preview does not serve
sitemap.xmlorrobots.txt) - Site identity fields in
docs.json; see Apply your branding forname, logo, and related settings that feed share cards - Optional: a custom domain when you want canonical URLs on your own host (requires a setup request)
docs.page emits <title>, description, Open Graph, and Twitter Card tags on every published page. Set defaults once in docs.json; individual pages can override them in frontmatter.
Give crawlers a clear site title and summary
Add
nameanddescriptionat the top level ofdocs.json. These values become the fallback when a page has no frontmatter:json{ "name": "Acme Docs", "description": "Guides and API reference for the Acme platform." }Search engines and social apps use these strings in result snippets and link previews. Keep the description concise: one or two sentences that say what the docs cover.
Control the default share-card image
Set
socialPreviewto a repo-relative path underdocs/or an absolute URL for a static preview image on every page:json{ "socialPreview": "/assets/og-default.png" }When
socialPreviewis unset, docs.page generates a card from the resolved title, description, and logo (from Apply your branding orog.logo). SetsocialPreviewtofalseto omit a default image entirely.Push and preview on a hosted URL
Commit and push your changes, then open a branch preview or production URL. Metadata and crawler files are served from the hosted origin, not from
docs previewon localhost.
| Field | Used when page frontmatter is empty |
|---|---|
| Title | name → "Documentation" |
| Description | description in docs.json |
| Preview image | socialPreview → auto-generated card |
Field types and defaults: docs.json.
High-traffic or landing pages deserve their own titles and descriptions. Per-page YAML frontmatter overrides the site defaults for that file only.
Override title and description where it matters
Add frontmatter at the top of the MDX file:
yaml--- title: Getting started with Acme description: Install the SDK, authenticate, and send your first API request in under ten minutes. ---The page
<head>uses frontmattertitleanddescriptionfirst, then falls back todocs.json. The same values feed Open Graph and Twitter Card tags.Set a page-specific preview image when needed
Add
imagein frontmatter to overridesocialPreviewfor one page, useful for launch announcements or guides with distinct artwork:yaml--- title: API reference description: Request and response shapes for every endpoint. image: /assets/og-api.png ---
For every frontmatter field, see Page frontmatter.
docs.page generates both files automatically from your repository. You do not add or edit them in the repo.
When seo.noindex is false (the default):
robots.txtallows all paths and points crawlers to your sitemap URLsitemap.xmllists one URL per documentation page underdocs/(index pages at priority1.0, other pages at0.8, all withchangefreq: weekly)
Open these URLs on your production site, custom domain, or branch preview (replace {owner} and {repo} with your GitHub coordinates):
https://docs.page/{owner}/{repo}/robots.txt
https://docs.page/{owner}/{repo}/sitemap.xml
https://docs.page/{owner}/{repo}~{ref}/robots.txt
https://docs.page/{owner}/{repo}~{ref}/sitemap.xmlOn a custom domain, the same paths sit at the domain root. The sitemap includes every page file in the tree; it does not filter by sidebar visibility or per-page noindex.
Use indexing controls when the site or specific pages should stay out of search results (internal runbooks, pre-release docs, or draft stubs you still keep in the repository).
Block the entire site from search results
Set
seo.noindextotrueindocs.json:json{ "seo": { "noindex": true } }This updates two layers:
robots.txtreturnsDisallow: /(and omits the sitemap line), and every page adds<meta name="robots" content="noindex" />in the document head. Crawlers that respect these signals stop indexing new content; existing listings may take time to drop after re-crawl.If you migrated from docs.page v1, the top-level
noindexfield maps toseo.noindex.Hide individual pages while keeping the site indexed
Add
noindex: trueto a page's frontmatter when most pages should appear in search but a few should not (draft changelogs, legal stubs, or redirect helpers):yaml--- title: Draft release notes description: Work in progress, not for public search. noindex: true ---Per-page
noindexadds the meta tag for that page only. It does not changerobots.txtor remove the URL fromsitemap.xml.
| Goal | Setting |
|---|---|
| Nothing on the site should be indexed | seo.noindex: true in docs.json |
| Most pages indexed; a few excluded | noindex: true in page frontmatter |
- Open your branch preview or production URL, not local preview.
- Fetch
robots.txtand confirm it allows crawling (orDisallow: /whenseo.noindexis enabled) and references your sitemap when indexing is allowed. - Open
sitemap.xmland confirm your key pages appear with the expected URLs. - View page source on a documentation page and check
<title>,<meta name="description">, Open Graph tags, and<meta name="robots">whennoindexapplies. - Optional: submit the sitemap URL in Google Search Console after you request a custom domain or confirm your production URL.
| Symptom | Likely cause | Fix |
|---|---|---|
sitemap.xml or robots.txt returns 404 | Checked on local preview | Use a branch preview or production URL (crawler files are not generated locally) |
| Search snippet shows the wrong title or description | Missing or stale frontmatter; browser cache | Set title and description in page frontmatter; confirm the merged branch is live |
| Share preview shows the wrong image | Page lacks image; socialPreview unset | Set frontmatter image or socialPreview in docs.json; confirm logo paths from Apply your branding |
Page still appears in Google after noindex | Crawlers have not re-crawled yet | Allow time for re-crawl; confirm the live page source includes <meta name="robots" content="noindex" /> |
Page is in sitemap.xml but has noindex in frontmatter | Sitemap lists all repo pages; noindex is page-level only | Expected (crawlers should honor the meta tag); use site-wide seo.noindex to block everything |
robots.txt still lists a sitemap after enabling seo.noindex | Old response cached, or change not deployed | Confirm seo.noindex: true is on the deployed ref; hard-refresh or check the branch preview URL |
- Search engine indexing: how
sitemap.xml,robots.txt, and metadata are generated - Search: on-site ⌘K search for readers already on your docs
- Apply your branding:
name, logo, and theme settings that feed share cards - Custom domain: request a hostname for docs and crawler files on your own domain
- Page frontmatter: per-page
title,description,image, andnoindex - docs.json:
name,description,socialPreview, andseo.noindex
