MkDocs Monorepo Plugin

1.1.2 · active · verified Fri Apr 10

The mkdocs-monorepo-plugin provides monorepository support for MkDocs, allowing users to build multiple sets of documentation from a single MkDocs site. It addresses challenges in large codebases by enabling individual teams to manage their documentation (including `mkdocs.yml` files and `docs/` folders) within subdirectories, which are then intelligently merged into a single, cohesive documentation site. The current version is 1.1.2 and it follows a release cadence driven by new features, bug fixes, and compatibility updates.

Warnings

Install

Imports

Quickstart

This quickstart creates a simple monorepo documentation structure. A root `mkdocs.yml` includes sub-project `mkdocs.yml` files using the `!include` syntax. Run `mkdocs serve` from the root directory to build and view the merged documentation.

mkdir my-monorepo-docs
cd my-monorepo-docs

# Root mkdocs.yml
cat <<EOF > mkdocs.yml
site_name: My Monorepo Documentation
nav:
  - Home: 'index.md'
  - API v1: '!include api/v1/mkdocs.yml'
  - API v2: '!include api/v2/mkdocs.yml'
plugins:
  - monorepo
EOF

# Root index.md
cat <<EOF > index.md
# Welcome to My Monorepo Docs!

This is the main documentation site.
EOF

mkdir api
mkdir api/v1
mkdir api/v2

# Sub-project 1: api/v1
cat <<EOF > api/v1/mkdocs.yml
site_name: API v1 Docs
nav:
  - Overview: 'index.md'
  - Endpoints: 'endpoints.md'
EOF

cat <<EOF > api/v1/index.md
# API Version 1 Overview

Details for the first version of our API.
EOF

cat <<EOF > api/v1/endpoints.md
# API v1 Endpoints

- `/users`
- `/products`
EOF

# Sub-project 2: api/v2
cat <<EOF > api/v2/mkdocs.yml
site_name: API v2 Docs
nav:
  - New Features: 'index.md'
  - Migration Guide: 'migration.md'
EOF

cat <<EOF > api/v2/index.md
# API Version 2: What's New

Introducing the second iteration of our API.
EOF

cat <<EOF > api/v2/migration.md
# Migrating to API v2

Follow these steps to upgrade.
EOF

# Build and serve the documentation
mkdocs serve

view raw JSON →