Skip to main content

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.

The @docusaurus/plugin-content-docs plugin is the backbone of most Docusaurus sites. It organizes Markdown files into a hierarchical documentation system with sidebars, pagination, versioning, and plugin instances — giving you everything you need to maintain professional documentation at scale.

Creating your first doc

Place Markdown files in the docs/ directory and Docusaurus automatically turns them into pages. The file path determines the document’s default URL and sidebar position.
website/
├── docs/
   ├── intro.md          # → /docs/intro
   └── tutorial/
       └── basics.md     # → /docs/tutorial/basics
├── docusaurus.config.js
A minimal doc file looks like this:
docs/intro.md
---
description: Create a doc page with rich content.
---

# Hello from Docusaurus

Are you ready to create the documentation site for your open source project?

## Headers

Headers appear in the table of contents on the right side of the page.

## Lists

- Lists help you present the key points
- that you want your users to remember
Files prefixed with an underscore (_) inside the docs/ directory are treated as partial pages and are not given their own route. Use them to share reusable Markdown snippets across multiple docs.

Doc frontmatter

Frontmatter enriches each document with metadata. Docusaurus can infer all required metadata without it, but frontmatter gives you explicit control over IDs, titles, sidebar labels, and ordering.
docs/my-doc.md
---
id: my-doc-id
title: My Document Title
description: A brief description for SEO.
sidebar_label: Short Sidebar Label
sidebar_position: 2
tags:
  - getting-started
  - overview
slug: /custom-url-path
---

# My Document Title

Content goes here.

id

Unique identifier used in sidebar config and cross-doc links. Defaults to the file path relative to the docs root.

title

Page title shown in the browser tab and at the top of the page. Defaults to the first # heading.

sidebar_label

Shorter label displayed in the sidebar navigation. Falls back to title if omitted.

sidebar_position

Numeric position within the sidebar. Lower numbers appear first. Defaults to alphabetical ordering.

slug

Custom URL path for the document, overriding the file-path-derived default.

tags

Categorization tags that create tag index pages and cross-doc filtering.
Sidebars group related documents into a navigable tree. You can let Docusaurus generate one automatically or define it manually.

Auto-generated sidebar

When sidebarPath is not set, Docusaurus generates a sidebar from the docs/ filesystem structure:
sidebars.js
export default {
  mySidebar: [
    {
      type: 'autogenerated',
      dirName: '.', // generate from the entire docs folder
    },
  ],
};
The sidebar_position frontmatter field controls item order within each directory level.

Manual sidebar

Define the structure explicitly to get full control over grouping, labels, and ordering:
sidebars.js
export default {
  tutorialSidebar: [
    {
      type: 'category',
      label: 'Getting Started',
      items: [
        { type: 'doc', id: 'intro' },
        { type: 'doc', id: 'installation' },
      ],
    },
    {
      type: 'category',
      label: 'Guides',
      items: [
        { type: 'doc', id: 'guides/pages' },
        { type: 'doc', id: 'guides/markdown' },
      ],
    },
    {
      type: 'link',
      label: 'API Reference',
      href: 'https://example.com/api',
    },
  ],
};
Register the sidebars file in your config:
docusaurus.config.js
export default {
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          sidebarPath: './sidebars.js',
        },
      },
    ],
  ],
};
The recommended approach is to let autogeneration handle ordering via sidebar_position in frontmatter, and mirror the sidebar structure in your file system. Use manual sidebar entries only for external links or when you need cross-directory groupings.

Docs-only mode

If your site is exclusively documentation (no landing page), serve docs at the root URL by setting routeBasePath: '/':
docusaurus.config.js
export default {
  presets: [
    [
      '@docusaurus/preset-classic',
      {
        docs: {
          routeBasePath: '/', // serve docs at the site's root
        },
        blog: false, // optional: disable the blog plugin
      },
    ],
  ],
};
Then add slug: / to whichever document should become the homepage:
docs/intro.md
---
slug: /
---

This page is now the site root.
If you add slug: / to a doc, delete src/pages/index.js — otherwise two files will map to the same route and Docusaurus will warn about a conflict.

Versioning basics

Docusaurus supports maintaining multiple documentation versions side-by-side. Run the versioning CLI to snapshot the current docs/ directory:
npm run docusaurus docs:version 1.1.0
This command:
  • Copies docs/ to versioned_docs/version-1.1.0/
  • Saves sidebar config to versioned_sidebars/version-1.1.0-sidebars.json
  • Appends 1.1.0 to versions.json
website/
├── docs/                          # "current" (next) version
├── versioned_docs/
   ├── version-1.1.0/             # latest released version
   └── version-1.0.0/             # older version
├── versioned_sidebars/
   └── version-1.1.0-sidebars.json
└── versions.json
Configure versioning with these plugin options in docusaurus.config.js:
  • lastVersion: Which version the /docs route serves (defaults to the latest tagged version).
  • includeCurrentVersion: Whether to expose the ./docs folder as a “next” version.
  • disableVersioning: Remove all versioning and serve only the current docs.
  • onlyIncludeVersions: Limit which versions are built (useful to speed up dev and CI).

Build docs developers (and LLMs) love