Content Management and Theme Customization
Separate content and theme: keep docs in Markdown/MDX, and encapsulate styles/components in the theme layer for reuse and upgrades.
Content organization
- Use Content Collections to define frontmatter schema (title, description, tags, dates).
- Structure directories by module/version/language; semantic file names.
- Generate nav/sidebar via
getCollectionto avoid hardcoding.
Theme design
- Layouts:
DocsLayouthandles header/sidebar/footer/theme switch. - UI components: Alert, Badge, Callout, CodeTabs, TOC, Breadcrumb managed centrally.
- Colors & fonts: CSS variables with dark mode; set values in
:rootand.dark.
MDX component mapping
- In docs,
export const components = { h2: HeadingWithIconH2, pre: CodeBlock, ... }. - Auto-style Markdown headings; customize code blocks (line numbers, copy button).
- Provide dedicated components for callouts, API tables, step lists.
Localization and versioning
- Language paths like
/zh-cn//en/, or build nav from frontmatter locale. - Versioning via
v1/v2/folders or frontmatter version; group sidebar by version.
Accessibility and maintainability
- Avoid heading-level jumps to keep TOC correct.
- Add alt text for images; clear table headers.
- Keep link casing/paths consistent.
Theme publishing/reuse
- Keep theme components/styles in a package or subdir; expose minimal API.
- Reuse via npm or git submodule; watch for breaking changes.***