导航菜单

Content Management and Theme Customization

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 getCollection to avoid hardcoding.

Theme design

  • Layouts: DocsLayout handles 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 :root and .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.***

搜索