| description | Use when creating, editing, or reorganizing MDX documentation pages in docs/, community/, or ecosystem/. Covers frontmatter shape, file naming, category metadata, and import conventions. |
|---|---|
| applyTo | {docs,community,ecosystem}/**/*.mdx |
Every MDX page starts with YAML frontmatter, then imports, then content:
---
id: short_id
title: "Page Title"
sidebar_position: 1
image: /img/png/theme/z/320x320.png
description: One-line summary
keywords:
- keyword1
- keyword2
---Required fields (build and commit validation will fail without these):
id— unique within its content root; used by Docusaurus for cross-linkingtitle— displayed in sidebar and browser tabsidebar_position— controls order inside the parent category
Recommended fields (reported as warnings by pnpm validate:frontmatter):
description— one-line summary; used by Algolia search and social previewskeywords— array of terms for Algolia and SEO
Exempt files: any .mdx file whose name starts with _ (e.g. MDX partials used as imports) does not need frontmatter and is skipped by validation.
Run pnpm validate:frontmatter before pushing to catch any missing fields.
Use numeric prefixes to control sidebar order: 01_first.mdx, 02_second.mdx.
Match the pattern of sibling files in the same directory.
When adding a new directory, create _category_.json:
{
"label": "Section Name",
"position": 3,
"link": {
"type": "generated-index"
}
}Emoji in labels is used throughout the project (e.g. "🚀 Getting Started").
Place imports immediately after frontmatter, before any content:
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Link from "@docusaurus/Link";
import Image from "@theme/IdealImage";Only import what is used on the page.
Important rules:
- Use
<Link to="...">— never<Link href="...">(thetoprop handles both internal and external URLs). - Never use
<Link>inside markdown headings — headings already wrap content in<a>for TOC anchors. Use[text](url)markdown syntax instead. - Globally available components (
<Highlight>,<Emoji>,<GhRepoBadge>,<ShellCodeCopy>) do not need imports — they are registered insrc/theme/MDXComponents.tsx. - See
.github/instructions/docusaurus-api.instructions.mdfor the full Docusaurus API surface and anti-patterns.
- Use
:::tip,:::info,:::warningadmonitions for callouts. - Reference images with site-root paths:
/img/.... - Always use
<Image>from@theme/IdealImagefor PNG/JPG images — never raw<img>ormarkdown syntax for content images (seedocusaurus-api.instructions.mdfor full guidance). - Use
<kbd>for keyboard/command sequences. - Heading IDs are managed by
pnpm write-heading-ids; add explicit{#custom-id}only when needed. - For HTML elements in MDX (
<kbd>,<details>,<samp>,<dl>, etc.), refer to the GitHub Flavored Markdown spec for supported tags.
- Edit only English source files in
docs/,community/,ecosystem/. - Do not manually edit files under
i18n/. - Some paths are excluded from translation (see
crowdin.yml):ecosystem/plugins/**,community/gallery/**,community/01_zsh_guide/**.