DocsDocumentationContributingAdding new docs

Adding new docs

Add new documents to your documentation site and blog.

For documentation

  1. Create a new .mdx file in the apps/content/docs/[language] folder with the content of your document.
  2. Add the document to the site's navigation menu. To do this, add a new item to the src/config/docs.ts file in the sidebarNav property with the desired information, just follow the pattern of the existing items. By doing this, the document will also be added to the search command palette.

MDX Document Settings

MDX documents are stored in the apps/content/docs/[language] and apps/content/blog/[language] folder. Each document is an MDX file that contains a header with metadata, such as title and description. Below is an example of a document header:

---
title: Document Title
description: Document Description.
sort: 1
---

The following metadata fields are supported:

  • title (required): The title of the document.
  • description (required): A brief description of the document.
  • sort (optional): A number that determines the order of the document in navigation. Documents with lower sort values appear first. If not provided, documents are sorted alphabetically by title.
  • links (optional): Links to related documents, API references, source code, etc.
  • toc (optional): Whether to show the table of contents. Defaults to true.

To add new metadata to the document, you can add new keys to the header. For example, you can add an author key to indicate the document author:

---
title: Document Title
description: Document Description.
sort: 2
author: Author Name
---

But when adding custom metadata, you also need to update the contentlayer.config.ts file located at the root of the project and inside the fields property in the Doc or Blog constants. After that, you will need to display the new information in the document template. To do this, you will need to update the src/app/[locale]/docs/[[...slug]]/page.tsx file, or src/app/[locale]/blog/[[...slug]]/page.tsx or one of its child components.

Rebuilding Contentlayer

When you make changes to documentation content, add new docs, or modify the contentlayer.config.ts file, you'll need to rebuild the contentlayer cache for your changes to take effect during development. Run:

cd apps/web
pnpm contentlayer:build

This command regenerates the content types and data needed by the application. You'll need to run this command whenever you:

  • Add new metadata fields to the contentlayer.config.ts file
  • Add or modify MDX content when the dev server isn't running
  • Change the structure of your content organization

The command is automatically run when building the project for production, but you'll need to run it manually during development if you make structural changes to content.