CmdocsCmdocs
Content

Frontmatter Reference

All supported frontmatter fields — title, description, icon, full, ogImage — and how they affect rendering and SEO.

Frontmatter Reference

Every MDX page starts with a YAML frontmatter block enclosed in --- delimiters. Frontmatter drives the page heading, sidebar entry, SEO meta tags, table of contents, and the search index.

---
title: Install the CLI
description: Add cmdocs to a new or existing project in under two minutes.
icon: Rocket
ogImage: /images/install-og.png
full: false
---

Required field

Prop

Type

cmdocs check fails any page that is referenced in navigation but missing a title — always set one.

Optional fields

Prop

Type

SEO tips

cmdocs generates OpenGraph and Twitter card tags from your frontmatter at build time. A few practical rules:

  • Keep description under 160 characters. Longer descriptions get truncated in Google search snippets and social previews.
  • Lead title with a concrete verb. "Install the CLI" reads better than just "Installation". Search result listings and breadcrumbs benefit.
  • Set a global seo.ogImage in docs.json so every page gets a social preview, then override per-page with frontmatter ogImage when you have a more specific image.
  • Match description to the page's intent. It's the first thing a reader sees before they click — make it a 1-sentence promise of what the page delivers.

How frontmatter flows through the pipeline

Every field is read once at build time:

FieldAffects
titleSidebar label, H1, browser tab title, search result title
description<meta name="description">, OpenGraph, Twitter card, search result snippet
iconSidebar icon (when the sidebar is configured to show icons)
ogImageOpenGraph + Twitter preview image
fullHides the table of contents for that page

Search index

cmdocs generates a static Orama search index at build time by walking every page's frontmatter and rendered content. title and description are indexed with higher weight than body content, so they dominate the ranking. Pages without a description still index — they just get a slightly weaker match on broad queries.

Overriding sidebar display from frontmatter

The sidebar label defaults to the frontmatter title. If you want a shorter sidebar entry than the on-page heading, set label on the page declaration in docs.json:

{
  "pages": [
    { "file": "guides/install-the-cli", "label": "Install" }
  ]
}

The <h1> stays "Install the CLI" (from frontmatter); the sidebar shows "Install" (from docs.json). Same idea for overriding the URL via path.

Complete example

guides/install-the-cli.mdx
---
title: Install the CLI
description: Add cmdocs to a new or existing project in under two minutes.
icon: Rocket
ogImage: /images/install-og.png
---

# Install the CLI

Your content here…

Notes

  • Frontmatter lives above the closing ---. Everything below is MDX body content.
  • YAML is whitespace-sensitive — indent with spaces, not tabs.
  • Unknown fields are ignored (not errors). If you want to attach custom metadata for tooling, put it here.
  • The pipeline validates frontmatter on every build; typos in field names silently fall back to defaults.

What's next

How is this guide?

On this page