# ai-docs **Repository Path**: ddgetget/ai-docs ## Basic Information - **Project Name**: ai-docs - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-23 - **Last Updated**: 2026-04-23 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # `site-menu.mts` 生产模板合集 本文档整理了当前 `docs` 目录结构,并给出多个可直接复制的 `/.vitepress/site-menu.mts` 版本,覆盖以下场景: - 顶部直链(首页/目录/外链) - 顶部下拉菜单 - 下拉中分组 + 嵌套分组 - 混合模式(直链 + 下拉同时存在) - 目录点击后左侧栏自动展示该目录子目录 --- ## 当前 `docs` 目录树(基于现有文件) ```text docs/ ├─ index.md ├─ recent/ │ └─ index.md ├─ opencv/ │ ├─ index.md │ ├─ opencv1.md │ ├─ opencv2.md │ ├─ ... │ └─ opencv31.md └─ llm/ ├─ deepseek/ │ ├─ index.md │ ├─ DeepSeek-V3.md │ └─ DeepSeek R1.md └─ vit/ ├─ index.md ├─ vit.md └─ vit-research.md ``` --- ## 版本 A:最简生产版(推荐起步) 特点:`首页 + 一个下拉`,下拉里放真实目录入口。 ```ts import type { SiteMenuRoot } from './site-menu.types' export const siteMenu: SiteMenuRoot = { links: [ { kind: 'home', text: '首页' }, { kind: 'group', text: '文档', items: [ { kind: 'section', text: 'Recent', path: 'recent' }, { kind: 'section', text: 'OpenCV', path: 'opencv' }, { kind: 'section', text: 'LLM', path: 'llm' }, ], }, ], } ``` --- ## 版本 B:顶部扁平直链版(无下拉) 特点:所有入口直接显示在顶部,适合菜单项不多时。 ```ts import type { SiteMenuRoot } from './site-menu.types' export const siteMenu: SiteMenuRoot = { links: [ { kind: 'home', text: '首页' }, { kind: 'section', text: 'Recent', path: 'recent' }, { kind: 'section', text: 'OpenCV', path: 'opencv' }, { kind: 'section', text: 'LLM', path: 'llm' }, ], } ``` --- ## 版本 C:混合版(直链 + 下拉 + 外链) 特点:常用目录直达,其他入口放下拉,同时支持第三方链接。 ```ts import type { SiteMenuRoot } from './site-menu.types' export const siteMenu: SiteMenuRoot = { links: [ { kind: 'home', text: '首页' }, { kind: 'section', text: 'OpenCV', path: 'opencv' }, { kind: 'group', text: '更多', items: [ { kind: 'section', text: 'LLM', path: 'llm' }, { kind: 'section', text: 'Recent', path: 'recent' }, { kind: 'external', text: '团队主页', href: 'https://example.com' }, ], }, ], } ``` --- ## 版本 D:下拉含分组与嵌套组(覆盖复杂场景) 特点:适合多团队/多域内容,层级更清晰。 ```ts import type { SiteMenuRoot } from './site-menu.types' export const siteMenu: SiteMenuRoot = { links: [ { kind: 'home', text: '首页' }, { kind: 'group', text: '文档导航', items: [ { kind: 'section', text: 'Recent', path: 'recent' }, { kind: 'group', text: '计算机视觉', items: [ { kind: 'section', text: 'OpenCV', path: 'opencv' }, ], }, { kind: 'group', text: '大模型', items: [ { kind: 'section', text: 'LLM', path: 'llm' }, { kind: 'external', text: '模型平台', href: 'https://example.com/llm' }, ], }, ], }, ], } ``` --- ## 版本 E:纯目录入口版(全由目录驱动侧栏) 特点:不放 `page`,全部使用 `section`,侧栏完全自动化。 ```ts import type { SiteMenuRoot } from './site-menu.types' export const siteMenu: SiteMenuRoot = { links: [ { kind: 'home', text: '首页' }, { kind: 'section', text: 'Recent', path: 'recent' }, { kind: 'section', text: 'OpenCV', path: 'opencv' }, { kind: 'section', text: 'LLM', path: 'llm' }, ], } ``` --- ## 维护规则(只改 `site-menu.mts`) - `section.path` 必须对应 `docs` 下实际目录(如 `llm`、`opencv`) - `page.path` 必须对应 `docs/.md`(你当前更推荐 `section` 驱动) - `external.href` 填完整 URL(`https://...`) - 目录名大小写需与磁盘一致(例如 `llm` 不能写成 `LLM`) --- ## 常见操作 - 本地开发:`pnpm docs:dev` - 构建检查:`pnpm docs:build` - Python 启动(已支持按需自动构建):`uv run main.py`