IntegrationsMonorepo

Monorepo

Publish your documentation from a folder of a GitHub or GitLab repository, and publish several sites from one repository.

Overview

By default, Documentation.AI expects documentation.json at the root of your repository. If your docs live in a folder, such as docs next to your application code, turn on Monorepo and enter that folder. This works the same way for GitHub and GitLab.

The folder you enter is the documentation root: the folder that holds documentation.json.

The acme/platform repository with apps, packages and docs folders. The docs folder is marked as the documentation root and holds documentation.json, introduction.mdx, guides and images. Beside it, the live site docs.acme.com, built from that folder.
The acme/platform repository with apps, packages and docs folders. The docs folder is marked as the documentation root and holds documentation.json, introduction.mdx, guides and images. Beside it, the live site docs.acme.com, built from that folder.
  • Paths start at the folder: every page, image, and OpenAPI path is relative to the documentation root.
  • The editor shows only the folder: files outside it do not appear in the dashboard.
  • Publishing stays inside the folder: changes you publish from the dashboard are committed inside it.
  • Pushes outside the folder do not deploy: your site deploys when a push changes files inside the folder.

Before you start

  • A GitHub repository or GitLab project with documentation.json in the folder you want to publish from
  • The folder's path from the repository root, such as docs or apps/docs. A slash at the start or the end is ignored.

Set the folder when you connect a repository

Connect an existing repository

When you create a documentation project, choose Git, then Connect an existing repository. Install the GitHub App and connect the repository.

Turn on Monorepo

Turn on Monorepo and enter the folder that holds documentation.json.

Create the project

Click Create project. Documentation.AI checks the folder first. If it has no documentation.json, the reason appears under the folder field and the project is not created until you correct it.

To move an existing project to a repository that keeps its docs in a folder, see Change the source repository. The Change source repository dialog has the same Monorepo switch.

Change the folder later

These steps are the same for GitHub and GitLab.

Open Git Settings

Go to Settings → Git Settings and find the Monorepo row in the Source repository box.

Enter the folder

Turn on Monorepo and enter the folder, or turn it off to publish from the repository root. Click Save.

Confirm

In the Change Documentation Root dialog, click Change Root.

Git Settings with the repository acme/platform on the main deployment branch, Monorepo switched on and docs entered as the folder, next to a Save button. Over its corner, the Change Documentation Root confirmation with a Change Root button.
Git Settings with the repository acme/platform on the main deployment branch, Monorepo switched on and docs entered as the folder, next to a Save button. Over its corner, the Change Documentation Root confirmation with a Change Root button.

Changing the documentation root discards unpublished edits and redeploys your whole site from the new folder.

Publish several sites from one repository

Several documentation projects can publish from the same repository, each from its own folder, such as docs and api-docs. Connect the repository to each project and enter a different folder for each.

A push to main in acme/platform that changes docs/guides/install.mdx and docs/images/setup.png. The Product docs site, published from the docs folder, is deploying. The API reference site, published from the api-docs folder, shows no changes.
A push to main in acme/platform that changes docs/guides/install.mdx and docs/images/setup.png. The Product docs site, published from the docs folder, is deploying. The API reference site, published from the api-docs folder, shows no changes.
  • Folders cannot overlap: two projects cannot use the same folder, and one folder cannot be inside another. A project that publishes from the repository root cannot share the repository.
  • A push deploys only what it changed: a push deploys the projects whose folder it changed. A push that only changes files outside a project's folder does not deploy that project.
  • One deployment branch: projects that share a repository share its deployment branch.

Troubleshooting