Frontmatter

Complete reference for every frontmatter field Boltdocs recognizes, including routing, sidebar, SEO, and display metadata.

Frontmatter is a YAML block at the top of any .md or .mdx file, enclosed by triple dashes (---). Boltdocs reads it to control routing, sidebar display, SEO, and page metadata.

md

# Getting Started

Your page content starts here...

Complete ReferenceLink

PropertyTypeDefaultDescription
titlestringFile nameThe page title shown in the sidebar, browser tab, and OG tags. If omitted, Boltdocs uses the file name (with the numeric prefix stripped).
descriptionstringFirst paragraphA short description for SEO meta tags and search result snippets. Max 500 characters.
permalinkstring—Overrides the auto-generated URL for this page (e.g., '/docs/my-custom-path').
sidebarPositionnumber—Explicit position of this page within its sidebar group. Lower numbers come first.
sidebarLabelstringtitleA shorter label to show in the sidebar instead of the full page title.
sidebarHiddenbooleanfalseHides this page from the sidebar while keeping it accessible via its URL.
hiddenbooleanfalseAlias of sidebarHidden.
ordernumber—Alternative ordering field. Behaves the same as sidebarPosition.
badgestring | BadgeConfig—A badge shown next to the page title in the sidebar. See BadgeConfig below.
iconstring—A Lucide icon name (e.g., 'Rocket') or inline SVG string shown next to the page title.
datestring | Date—Page publication date. Used in blog-style docs or changelogs.
lastUpdatedstring | Date—Timestamp shown in the "Last updated" footer.
categorystring—Free-form category label (max 50 characters).
groupTitlestringFolder nameOn an index.md file, overrides the sidebar group title for the containing folder.
groupPositionnumber—On an index.md file, sets the ordering position of the entire group in the sidebar.
seoRecord<string, any>—Custom Open Graph and meta tag overrides. See seo below.

BadgeConfigLink

The badge field accepts either a simple string or an object with an optional expiration date. When an expiration is set and the date has passed, Boltdocs automatically hides the badge.

PropertyTypeDescription
textstringThe badge label (e.g., 'New', 'Beta', 'Deprecated'). Max 50 characters.
expiresstringAn ISO 8601 date string. After this date, the badge is no longer displayed.

Examples:

md
---
# Simple string badge
badge: New

# Badge with expiration date
badge:
  text: Beta
  expires: '2026-12-31'
---

seo FieldLink

Overrides or extends the auto-generated SEO meta tags for a specific page:

md
---
seo:
  og:image: /assets/my-custom-og-image.png
  og:type: article
  twitter:card: summary_large_image
---

Any keys you provide here are merged over Boltdocs' default generated tags.


Use permalink to decouple a page's URL from its file location. This is useful for migrating content without breaking existing links:

md
---
title: Legacy Setup Guide
permalink: /docs/setup
---

The file can live anywhere in docs/, but it will always be served at /docs/setup.

Permalink conflicts

If two pages share the same permalink, the last one processed wins and a warning is printed to the console. Always make sure permalinks are unique.


Custom Frontmatter and useMdxComponentsLink

You're not limited to the built-in frontmatter properties. You can add arbitrary custom keys to any page's frontmatter block to attach extra metadata (e.g., authors, versions, or status tags):

md
---
title: Advanced Guide
author: "Jane Doe"
version: "v2.1.0"
---

To render these custom fields using custom UI components, you can register components prefixed with Frontmatter_ inside your docs/mdx-components.tsx file.

Step 1: Register Custom Frontmatter ComponentsLink

Export your formatting components by prefixing their names with Frontmatter_:

docs/mdx-components.tsx
// Mapped component for the 'author' frontmatter key
function Frontmatter_author({ value }: { value: string }) {
  return (
    <div className="flex items-center gap-2 mt-2">
      <span className="text-xs font-semibold text-zinc-500">Author:</span>
      <span className="text-sm text-zinc-900 dark:text-zinc-100">{value}</span>
    </div>
  )
}

// Mapped component for the 'version' frontmatter key
function Frontmatter_version({ value }: { value: string }) {
  return (
    <span className="inline-block bg-primary-500/10 text-primary-500 text-xs px-2 py-0.5 rounded-full">
      Added in {value}
    </span>
  )
}

export default {
  Frontmatter_author,
  Frontmatter_version,
} 

Step 2: Fetch and Render via the HookLink

In your layout or custom components, you can call the useMdxComponents hook to get your frontmatter registry. Boltdocs automatically strips the Frontmatter_ prefix and places these components in a nested Frontmatter namespace:

docs/layout.tsx
import { useMdxComponents, useRoutes } from 'boltdocs/client'

export default function CustomLayout({ children }) {
  const { currentRoute } = useRoutes()
  const components = useMdxComponents()

  // Extract the custom frontmatter data from the current route
  const author = currentRoute?.frontmatter?.author
  const version = currentRoute?.frontmatter?.version

  // Get the mapped formatter components
  const AuthorFormatter = components.Frontmatter?.author
  const VersionFormatter = components.Frontmatter?.version

  return (
    <div>
      <header>
        {AuthorFormatter && author && <AuthorFormatter value={author} />}
        {VersionFormatter && version && <VersionFormatter value={version} />}
      </header>
      <main>{children}</main>
    </div>
  )
}
Last updated on October 18, 2026

Was this page helpful?