Adding new docs
Add new documents to your documentation site and blog.
For documentation
- Create a new
.mdxfile in a section folder underapps/content/docs/en, such asapps/content/docs/en/apps/jellyfin.mdx. - Add the frontmatter described below, then write the page.
The sidebar and the search command palette are built from the English files by apps/web/src/config/docs.ts. Each folder becomes a section and each file becomes a page in it, so a new file appears without any configuration change. A new folder adds a new section, so discuss it in an issue first.
Write new pages in English only. See Writing docs for where pages go, the app page template and the style guide.
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 its section. Documents with asortvalue come first, lowest first. Documents without one follow, 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 totrue.
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 add the field to the matching schema (docSchema, blogSchema or policySchema) in apps/web/src/lib/content/index.ts. Frontmatter keys that aren't in the schema are dropped.
After that, you will need to display the new information in the document template. To do this, you will need to update the apps/web/src/app/[locale]/(marketing)/docs/[[...slug]]/page.tsx file, or apps/web/src/app/[locale]/(marketing)/blog/[[...slug]]/page.tsx or one of its child components.
Checking your changes
The site reads the MDX files directly, so pnpm dev shows changes when you refresh the page. If a file's frontmatter is invalid, pnpm dev leaves that page out and prints the file and field in the terminal. pnpm build checks every file in every language and fails if any are invalid.