create-react-docs-ui 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,82 +1,85 @@
1
- # create-react-docs-ui
2
-
3
- A simple scaffolding tool to quickly set up a modern documentation website powered by [react-docs-ui](https://github.com/btea/react-docs-ui).
4
-
5
- This tool creates a new project with a pre-configured, feature-rich documentation site, allowing you to focus solely on writing your Markdown content.
6
-
7
- ## About the underlying library: react-docs-ui
8
-
9
- `react-docs-ui` is a React component library and toolset designed specifically for building documentation websites. Its core philosophy is **configuration over code**.
10
-
11
- ### Core Features
12
-
13
- - **Configuration-Driven**: No need to write complex React components or routing logic. Define your entire site—navigation, sidebar, themes, and footer—through a simple `site.yaml` file.
14
- - **Fully-Featured Out-of-the-Box**:
15
- - Responsive, modern design.
16
- - Light/dark theme switching.
17
- - Markdown rendering (GFM and Frontmatter supported).
18
- - Built-in syntax highlighting.
19
- - Quick command menu (`Cmd+K`).
20
- - Internationalization (i18n) support.
21
- - **Extremely Simple to Start**: Launch a complete documentation site in under a minute.
22
- - **Highly Customizable**: Easily customize the logo, color scheme, navigation links, social media icons, and more.
23
-
24
- ## Getting Started
25
-
26
- ### Prerequisites
27
-
28
- - **Node.js**: Version `>= 18.0.0`
29
- - **Package Manager**: `npm`, `yarn`, or `pnpm`
30
-
31
- ### Creating a New Project
32
-
33
- Run one of the following commands to create your new documentation site. Replace `my-docs` with your desired project name.
34
-
35
- #### npm
36
- ```bash
37
- npm create react-docs-ui@latest my-docs
38
- ```
39
-
40
- #### yarn
41
- ```bash
42
- yarn create react-docs-ui my-docs
43
- ```
44
-
45
- #### pnpm
46
- ```bash
47
- pnpm create react-docs-ui my-docs
48
- ```
49
-
50
- ### Running Your Site
51
-
52
- After the project is created, navigate into the new directory, install dependencies, and start the development server.
53
-
54
- ```bash
55
- cd my-docs
56
- npm install
57
- npm run dev
58
- ```
59
-
60
- Your new documentation website will be running at `http://localhost:5173`.
61
-
62
- ## Project Structure
63
-
64
- The generated project has a straightforward structure:
65
-
66
- - **`public/config/site.yaml`**: The central configuration file for your entire site. This is where you'll define navigation, sidebars, and metadata.
67
- - **`public/docs/`**: The directory where all your Markdown documentation files reside. It's pre-configured with `en` and `zh-cn` subdirectories for internationalization.
68
- - **`src/`**: Contains the main application entry point. You typically won't need to modify files here.
69
-
70
- ## Basic Configuration
71
-
72
- To customize your site, you'll primarily edit `public/config/site.yaml`. Here you can:
73
-
74
- - **Change the site title and logo**: Modify the `site` object.
75
- - **Add navigation links**: Add items to the `navbar.items` array.
76
- - **Structure your documentation**: Define the hierarchy of your content in the `sidebar.collections` object.
77
-
78
- For a complete guide on all available options, please refer to the documentation within your newly created project.
79
-
80
- ## License
81
-
82
- This project is licensed under the [MIT License](LICENSE).
1
+ English | [简体中文](README-zh.md)
2
+
3
+ ## create-react-docs-ui
4
+
5
+ Scaffold a React documentation site in seconds, powered by [`react-docs-ui`](https://github.com/shenjianZ/react-docs-ui). Focus on writing Markdown; routing, theming, MDX, syntax highlighting, i18n, sidebar/TOC and a command menu are prewired.
6
+
7
+ ### Features
8
+ - Configuration over code via `public/config/site.yaml`
9
+ - MD/MDX rendering, syntax highlight, GFM, simple frontmatter parsing
10
+ - Light/dark theme and command palette (Cmd/Ctrl+K)
11
+ - Built-in i18n folders (e.g. `en`, `zh-cn`)
12
+ - Ready-to-run Vite setup
13
+
14
+ ### Requirements
15
+ - Node.js >= 18
16
+
17
+ ### Quick start
18
+ - npm:
19
+ ```bash
20
+ npm create react-docs-ui@latest my-docs
21
+ ```
22
+ - yarn:
23
+ ```bash
24
+ yarn create react-docs-ui my-docs
25
+ ```
26
+ - pnpm:
27
+ ```bash
28
+ pnpm create react-docs-ui my-docs
29
+ ```
30
+ Then:
31
+ ```bash
32
+ cd my-docs
33
+ npm install
34
+ npm run dev
35
+ ```
36
+ Dev server runs at http://localhost:5173
37
+
38
+ ### Scripts (generated project)
39
+ - `dev`: start Vite dev server
40
+ - `build`: type-check and build
41
+ - `preview`: preview production build
42
+
43
+ ### Project structure (generated)
44
+ - `public/config/site.yaml` and `public/config/site.en.yaml`: site config per language
45
+ - `public/docs/<lang>/**/*.md`: Markdown docs, matched by route slug
46
+ - `src/`: app entry; usually no changes required
47
+
48
+ ### Config example (`public/config/site.yaml`)
49
+ ```yaml
50
+ site:
51
+ logo: /logo.svg
52
+ title: My Docs
53
+ description: Awesome docs
54
+ navbar:
55
+ showTitle: true
56
+ items:
57
+ - title: GitHub
58
+ link: https://github.com/shenjianZ/react-docs-ui
59
+ external: true
60
+ sidebar:
61
+ collections:
62
+ guide:
63
+ sections:
64
+ - title: Getting Started
65
+ path: guide
66
+ children:
67
+ - { title: Introduction, path: guide/introduction }
68
+ ```
69
+
70
+ ### Docs example (`public/docs/en/guide/introduction.md`)
71
+ ```markdown
72
+ ---
73
+ title: Introduction
74
+ ---
75
+
76
+ # Introduction
77
+
78
+ Welcome to My Docs!
79
+ ```
80
+
81
+ ### Links
82
+ - Underlying UI library: `react-docs-ui` https://github.com/shenjianZ/react-docs-ui
83
+
84
+ ### License
85
+ [MIT](LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-react-docs-ui",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "bin": {
@@ -19,7 +19,20 @@
19
19
  "template/vite.config.ts",
20
20
  "README.md"
21
21
  ],
22
- "description": "Scaffold a React Docs UI project powered by react-docs-ui",
22
+ "description": "Scaffold a React documentation site with one command — built-in routing, theming, MDX, examples, and production-ready build config, powered by react-docs-ui.",
23
+ "homepage": "https://github.com/shenjianZ/create-react-docs-ui",
24
+ "keywords": [
25
+ "react",
26
+ "cli",
27
+ "scaffolding",
28
+ "starter",
29
+ "template",
30
+ "docs",
31
+ "documentation",
32
+ "mdx",
33
+ "boilerplate",
34
+ "create-tool"
35
+ ],
23
36
  "license": "MIT"
24
37
  }
25
38
 
@@ -2,13 +2,14 @@
2
2
  <html lang="en">
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
+ <link rel="icon" type="image/svg+xml" href="/images/favicon.svg" />
5
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>React Docs UI</title>
7
+ <title>Docs</title>
7
8
  </head>
8
9
  <body>
9
10
  <div id="root"></div>
10
11
  <script type="module" src="/src/main.tsx"></script>
11
12
  </body>
12
- </html>
13
+ </html>
13
14
 
14
15
 
@@ -1,7 +1,7 @@
1
1
  # Website Configuration
2
2
  site:
3
- title: "Vue Docs UI Example"
4
- description: "Example documentation website built with Vue Docs UI"
3
+ title: "React Docs UI Example"
4
+ description: "Example documentation website built with React Docs UI"
5
5
  # Logo formats supported:
6
6
  # 1. emoji: "🤖"
7
7
  # 2. image URL: "https://example.com/logo.png"
@@ -10,7 +10,7 @@ site:
10
10
  logo:
11
11
  light: "/images/favicon.svg"
12
12
  dark: "/images/favicon-dark.svg"
13
- author: "Vue Docs UI Team"
13
+ author: "React Docs UI Team"
14
14
 
15
15
  # Navigation Bar Configuration
16
16
  navbar:
@@ -25,7 +25,7 @@ navbar:
25
25
  link: "/guide"
26
26
  actions:
27
27
  - type: "github"
28
- link: "https://github.com/shenjianZ/vue-docs-ui"
28
+ link: "https://github.com/shenjianZ/React-docs-ui"
29
29
  enabled: true
30
30
 
31
31
  # Sidebar Navigation Configuration
@@ -73,7 +73,7 @@ toc:
73
73
  # Footer Configuration
74
74
  footer:
75
75
  enabled: true
76
- copyright: "© 2024 Vue Docs UI. All rights reserved."
76
+ copyright: "© 2024 React Docs UI. All rights reserved."
77
77
  repository:
78
78
  url: "https://github.com/your_github_id/your_repo_name"
79
79
  branch: "master"
@@ -130,8 +130,8 @@ footer:
130
130
  # PWA Configuration
131
131
  pwa:
132
132
  enabled: false
133
- name: "Vue Docs UI"
134
- shortName: "VueDocsUI"
133
+ name: "React Docs UI"
134
+ shortName: "ReactDocsUI"
135
135
  description: "Beautiful documentation websites made simple"
136
136
  themeColor: "#ffffff"
137
137
  backgroundColor: "#ffffff"
@@ -1,7 +1,7 @@
1
1
  # 网站基本配置
2
2
  site:
3
- title: "Vue Docs UI 示例项目"
4
- description: "基于 Vue Docs UI 构建的文档网站示例"
3
+ title: "React Docs UI 示例项目"
4
+ description: "基于 React Docs UI 构建的文档网站示例"
5
5
  # logo支持以下格式:
6
6
  # 1. emoji: "🤖"
7
7
  # 2. 图片URL: "https://example.com/logo.png"
@@ -10,7 +10,7 @@ site:
10
10
  logo:
11
11
  light: "/images/favicon.svg"
12
12
  dark: "/images/favicon-dark.svg"
13
- author: "Vue Docs UI Team"
13
+ author: "React Docs UI Team"
14
14
 
15
15
  # 顶部导航配置
16
16
  navbar:
@@ -25,7 +25,7 @@ navbar:
25
25
  link: "/guide"
26
26
  actions:
27
27
  - type: "github"
28
- link: "https://github.com/shenjianZ/vue-docs-ui"
28
+ link: "https://github.com/shenjianZ/React-docs-ui"
29
29
  enabled: true
30
30
 
31
31
  # 侧边栏导航配置
@@ -73,7 +73,7 @@ toc:
73
73
  # Footer Configuration
74
74
  footer:
75
75
  enabled: true
76
- copyright: "© 2024 Vue Docs UI. All rights reserved."
76
+ copyright: "© 2024 React Docs UI. All rights reserved."
77
77
  repository:
78
78
  url: "https://github.com/your_github_id/your_repo_name"
79
79
  branch: "master"
@@ -130,8 +130,8 @@ footer:
130
130
  # PWA Configuration
131
131
  pwa:
132
132
  enabled: true
133
- name: "Vue Docs UI"
134
- shortName: "VueDocsUI"
133
+ name: "React Docs UI"
134
+ shortName: "ReactDocsUI"
135
135
  description: "Beautiful documentation websites made simple"
136
136
  themeColor: "#ffffff"
137
137
  backgroundColor: "#ffffff"
@@ -1,122 +1,149 @@
1
- # Configuration File (`site.yaml`) Explained
2
-
3
- The core of `react-docs-ui` is its **configuration-driven** philosophy. You can define the entire look and behavior of your website almost exclusively through the `public/config/site.yaml` file. This document explains each configuration option in detail.
4
-
5
- ## Top-Level Configuration Overview
6
-
7
- | Top-Level Field | Description |
8
- | :--- | :--- |
9
- | `site` | Global site information, such as title, description, and logo. |
10
- | `navbar` | Configures the top navigation bar of the website. |
11
- | `sidebar` | Configures the navigation menu in the website's sidebar. |
12
- | `theme` | Configures the website's theme, such as colors and light/dark mode. |
13
- | `footer` | Configures the footer information at the bottom of the website. |
14
- | `toc` | Configures the Table of Contents on the right side of article pages. |
15
-
16
- ---
17
-
18
- ## `site`
19
-
20
- Basic metadata configuration for the website.
21
-
22
- | Field | Description | Example |
23
- | :--- | :--- | :--- |
24
- | `title` | The website title, displayed in the browser tab. | `"React Docs UI"` |
25
- | `description` | The website description, used for Search Engine Optimization (SEO). | `"A React documentation website builder"` |
26
- | `logo` | The website logo, displayed in the top-left corner of the navbar. | `"📚"` or `"/images/logo.png"` or an object with `light` and `dark` image paths |
27
- | `author` | The author of the website. | `"React Docs UI Team"` |
28
-
29
- **Logo Format Guide:**
30
- 1. **Emoji**: Use an emoji directly, like `"🚀"`.
31
- 2. **Local Image**: A path to an image in the `public` directory, like `"/images/logo.png"`.
32
- 3. **Light/Dark Mode Images**: An object with `light` and `dark` keys, pointing to different image paths for each theme.
33
-
34
- ---
35
-
36
- ## `navbar`
37
-
38
- Top navigation bar configuration.
39
-
40
- | Field | Description |
41
- | :--- | :--- |
42
- | `items` | An array of navigation items that defines all the links displayed in the navbar. |
43
- | `actions` | (Optional) Action buttons on the right side of the navbar, such as a GitHub link. |
44
-
45
- ### `navbar.items`
46
-
47
- | Field | Description | Example |
48
- | :--- | :--- | :--- |
49
- | `title` | The display text for the navigation item. | `"Guide"` |
50
- | `link` | The link address. Internal links start with `/`. | `"/guide/introduction"` |
51
- | `external` | (Optional) If `true`, it's an external link that will open in a new tab. | `true` |
52
-
53
- ---
54
-
55
- ## `sidebar`
56
-
57
- Sidebar navigation configuration, which is the core of the documentation structure. It uses `collections` to organize different sections of content.
58
-
59
- | Field | Description |
60
- | :--- | :--- |
61
- | `collections` | An object where keys are collection names (usually corresponding to top-level routes like `guide`), and values are the sidebar configurations for that collection. |
62
-
63
- ### `sidebar.collections.<name>.sections`
64
-
65
- Each collection contains a `sections` array, where each `section` represents a collapsible menu group.
66
-
67
- | Field | Description | Example |
68
- | :--- | :--- | :--- |
69
- | `title` | The title of the section. | `"Getting Started"` |
70
- | `path` | The base path for the section. When a user visits a URL starting with this path, this section will automatically expand and be highlighted. | `"/guide"` |
71
- | `children` | An array of child links under this section. | |
72
-
73
- ### `sidebar.collections.<name>.sections.children`
74
-
75
- | Field | Description | Example |
76
- | :--- | :--- | :--- |
77
- | `title` | The display text for the child link. | `"Introduction"` |
78
- | `path` | The full path to the child link, pointing to a specific Markdown page. | `"/guide/introduction"` |
79
-
80
- ---
81
-
82
- ## `theme`
83
-
84
- Theme and appearance configuration.
85
-
86
- | Field | Description | Options | Default |
87
- | :--- | :--- | :--- | :--- |
88
- | `defaultMode` | The default theme mode for the website. | `'light'`, `'dark'`, `'system'` | `'system'` |
89
- | `allowToggle` | Whether to allow users to switch the theme. | `true`, `false` | `true` |
90
-
91
- ---
92
-
93
- ## `footer`
94
-
95
- Footer configuration.
96
-
97
- | Field | Description | Example |
98
- | :--- | :--- | :--- |
99
- | `copyright` | Copyright information. `{year}` will be replaced with the current year. | `"Copyright © {year} My Company"` |
100
- | `repository` | (Optional) Repository information, used for displaying links like "Edit this page on GitHub". | |
101
- | `links` | (Optional) Additional link columns displayed in the footer. | |
102
- | `social` | (Optional) Social media icon links displayed in the footer. | |
103
-
104
- ### `footer.repository`
105
-
106
- | Field | Description | Example |
107
- | :--- | :--- | :--- |
108
- | `url` | The URL of the repository. | `"https://github.com/user/repo"` |
109
- | `branch` | The Git branch where the documentation is located. | `"main"` |
110
- | `dir` | The root directory of the documentation files in the repository. | `"docs/src"` |
111
-
112
- ---
113
-
114
- ## `toc` (Table of Contents)
115
-
116
- Configuration for the table of contents on the right side of article pages.
117
-
118
- | Field | Description | Example |
119
- | :--- | :--- | :--- |
120
- | `enabled` | Whether to enable the page table of contents feature. | `true` |
121
- | `maxLevel` | The maximum heading level (h1-h6) to display in the TOC. | `3` |
122
- | `title` | The title of the TOC component. | `"On this page"` |
1
+ # Configuration File (`site.yaml`) Explained
2
+
3
+ The project is configuration-driven. Most behavior is defined in `public/config/site.yaml`. This page documents every field using concise tables.
4
+
5
+ ## Top-level keys
6
+ | Key | Purpose |
7
+ | :-- | :-- |
8
+ | `site` | Global metadata like title, description, logo, author |
9
+ | `navbar` | Top navigation bar (logo/title toggles, items, actions) |
10
+ | `sidebar` | Left navigation tree (collections/sections/children) |
11
+ | `theme` | Theme options (default mode, toggle) |
12
+ | `toc` | Article table of contents (enabled, levels, title) |
13
+ | `footer` | Footer links, socials, repository meta |
14
+ | `pwa` | Progressive Web App settings (reserved/optional) |
15
+
16
+ ---
17
+
18
+ ## `site`
19
+ | Field | Type | Description | Example |
20
+ | :-- | :-- | :-- | :-- |
21
+ | `title` | string | Site title | `"React Docs UI Example"` |
22
+ | `description` | string | Short site description (SEO) | `"Beautiful docs made simple"` |
23
+ | `logo` | string or object | Logo to display. String can be emoji or image path. Object allows light/dark images. | `"📚"`, `"/images/logo.png"`, or `{ light: "/images/favicon.svg", dark: "/images/favicon-dark.svg" }` |
24
+ | `author` | string | Site author/organization | `"React Docs UI Team"` |
25
+
26
+ Logo formats supported:
27
+ - Emoji: `"🚀"`
28
+ - URL or public path: `"/images/logo.png"`
29
+ - Light/Dark object: `{ light, dark }`
30
+
31
+ ---
32
+
33
+ ## `navbar`
34
+ | Field | Type | Description |
35
+ | :-- | :-- | :-- |
36
+ | `showLogo` | boolean | Show logo at top-left |
37
+ | `showTitle` | boolean | Show site title in navbar |
38
+ | `showLanguageSwitcher` | boolean | Show language switcher |
39
+ | `items` | array<Item> | Primary navigation links |
40
+ | `actions` | array<Action> | Right-side action buttons (e.g. GitHub) |
41
+
42
+ Item
43
+ | Field | Type | Description | Example |
44
+ | :-- | :-- | :-- | :-- |
45
+ | `title` | string | Link text | `"Guide"` |
46
+ | `link` | string | Path or URL. Internal paths start with `/`. | `"/guide"` |
47
+ | `external` | boolean (optional) | Open in new tab if true |
48
+ | `visible` | boolean (optional) | Conditionally hide/show |
49
+
50
+ Action
51
+ | Field | Type | Description | Example |
52
+ | :-- | :-- | :-- | :-- |
53
+ | `type` | `"github"` or `"custom"` (optional) | Predefined or custom action | `"github"` |
54
+ | `title` | string (optional) | Button text when `type` is `custom` |
55
+ | `link` | string | Destination URL |
56
+ | `icon` | string (optional) | Icon name for custom action |
57
+ | `enabled` | boolean (optional) | Toggle the action |
58
+
59
+ ---
60
+
61
+ ## `sidebar`
62
+ | Field | Type | Description |
63
+ | :-- | :-- | :-- |
64
+ | `enabled` | boolean (optional) | Global toggle for sidebar |
65
+ | `collections` | record<string, Collection> | Map of top-level sections (e.g. `guide`) |
66
+ | `sections` | Section[] (legacy, optional) | Backward-compatible single-tree definition |
67
+
68
+ Collection
69
+ | Field | Type | Description |
70
+ | :-- | :-- | :-- |
71
+ | `sections` | Section[] | Grouped side-nav sections |
72
+
73
+ Section
74
+ | Field | Type | Description | Example |
75
+ | :-- | :-- | :-- | :-- |
76
+ | `title` | string | Section title | `"Getting Started"` |
77
+ | `path` | string | Base path that expands/highlights this section | `"/guide"` |
78
+ | `children` | Child[] (optional) | Leaf links under the section |
79
+
80
+ Child
81
+ | Field | Type | Description | Example |
82
+ | :-- | :-- | :-- | :-- |
83
+ | `title` | string | Link text | `"Introduction"` |
84
+ | `path` | string | Full page path | `"/guide/introduction"` |
85
+
86
+ ---
87
+
88
+ ## `theme`
89
+ | Field | Type | Description | Options | Default |
90
+ | :-- | :-- | :-- | :-- | :-- |
91
+ | `defaultMode` | string | Default color mode | `light`, `dark`, `auto` | `auto` |
92
+ | `allowToggle` | boolean | Allow user theme switching | `true`/`false` | `true` |
93
+
94
+ ---
95
+
96
+ ## `toc`
97
+ | Field | Type | Description | Example |
98
+ | :-- | :-- | :-- | :-- |
99
+ | `enabled` | boolean | Enable page table of contents | `true` |
100
+ | `maxLevel` | number (1-6) | Max heading depth to show | `3` |
101
+ | `title` | string | TOC panel title | `"On This Page"` |
102
+
103
+ Note: Per-page TOC visibility/anchors are also affected by page frontmatter.
104
+
105
+ ---
106
+
107
+ ## `footer`
108
+ | Field | Type | Description |
109
+ | :-- | :-- | :-- |
110
+ | `enabled` | boolean | Show footer |
111
+ | `copyright` | string | Copyright text |
112
+ | `repository` | Repository (optional) | Repo info used for links like “Edit this page” |
113
+ | `lastUpdated` | string (optional) | Site/content last update date |
114
+ | `links` | Link[] (optional) | Footer link columns |
115
+ | `social` | Social[] (optional) | Social icon links |
116
+
117
+ Repository
118
+ | Field | Type | Description | Example |
119
+ | :-- | :-- | :-- | :-- |
120
+ | `url` | string | Repository URL | `"https://github.com/user/repo"` |
121
+ | `branch` | string | Docs branch | `"main"` |
122
+
123
+ Link
124
+ | Field | Type | Description |
125
+ | :-- | :-- | :-- |
126
+ | `title` | string | Link title |
127
+ | `link` | string | Path or URL |
128
+ | `external` | boolean (optional) | Open in new tab |
129
+
130
+ Social
131
+ | Field | Type | Description |
132
+ | :-- | :-- | :-- |
133
+ | `name` | string | Provider key (e.g. `github`, `twitter`, `bilibili`) |
134
+ | `url` | string | Profile or link URL |
135
+ | `icon` | string | Icon name |
136
+
137
+ ---
138
+
139
+ ## `pwa` (optional)
140
+ | Field | Type | Description |
141
+ | :-- | :-- | :-- |
142
+ | `enabled` | boolean | Enable PWA features (reserved) |
143
+ | `name` | string | App name |
144
+ | `shortName` | string | Short app name |
145
+ | `description` | string | App description |
146
+ | `themeColor` | string | Theme color |
147
+ | `backgroundColor` | string | Background color |
148
+
149
+ ---
@@ -1,109 +1,108 @@
1
- # Quick Start
2
-
3
- This guide will walk you through creating, configuring, and running your own React documentation website from scratch in 5 minutes.
4
-
5
- ## 1. Create the Project
6
-
7
- Using the official scaffolding tool is the most efficient way. Open your terminal and run the following command:
8
-
9
- ```bash
10
- # This creates a project named "my-awesome-docs"
11
- npx create-react-docs-ui@latest my-awesome-docs
12
- ```
13
-
14
- Next, enter the project directory and install the dependencies:
15
-
16
- ```bash
17
- cd my-awesome-docs
18
- npm install
19
- ```
20
-
21
- ## 2. Organize Your Documents
22
-
23
- All your documentation content is stored as Markdown files in the `public/docs/` directory.
24
-
25
- - Open the `public/docs/en/` directory.
26
- - You can modify the existing `index.md` and files under the `guide` directory, or create new `.md` files.
27
-
28
- For example, let's create a new page. Create a new file named `about.md` in `public/docs/en/`:
29
-
30
- ```markdown
31
- ---
32
- title: About Us
33
- description: This is a page about our team.
34
- ---
35
-
36
- # About Us
37
-
38
- We love open source and creation!
39
- ```
40
-
41
- **Note**: You can use `frontmatter` at the top of your Markdown files to define the page `title` and `description`.
42
-
43
- ## 3. Configure the Website
44
-
45
- Now, let's display the newly created page by modifying the configuration file.
46
-
47
- Open the core configuration file `public/config/site.yaml`.
48
-
49
- ### a. Modify Site Information
50
-
51
- Update the `site` section to give your website a new title and logo.
52
-
53
- ```yaml
54
- site:
55
- title: "My Awesome Docs"
56
- description: "A website built with React Docs UI"
57
- logo: "🚀" # You can use an emoji or an image path
58
- ```
59
-
60
- ### b. Add to the Navbar
61
-
62
- In the `navbar.items` array, add a link for the "About" page. Remember to update the links for the English version.
63
-
64
- ```yaml
65
- navbar:
66
- items:
67
- - title: "Home"
68
- link: "/en/"
69
- - title: "Guide"
70
- link: "/en/guide/introduction"
71
- - title: "About" # New
72
- link: "/en/about" # New
73
- ```
74
-
75
- ### c. Add to the Sidebar
76
-
77
- To make the "About" page visible in the sidebar, we'll add a new entry in `sidebar.collections.guide.sections`. Make sure to use English paths.
78
-
79
- ```yaml
80
- sidebar:
81
- collections:
82
- guide:
83
- sections:
84
- - title: "Getting Started"
85
- path: "/en/guide"
86
- children:
87
- - title: "Introduction"
88
- path: "/en/guide/introduction"
89
- - title: "Installation"
90
- path: "/en/guide/installation"
91
- - title: "Quick Start"
92
- path: "/en/guide/quick-start"
93
- # You can create a new section for the "About" page
94
- - title: "About Us"
95
- path: "/en/about"
96
- children:
97
- - title: "About"
98
- path: "/en/about"
99
- ```
100
-
101
- ## 4. Launch the Website
102
-
103
- Save all your changes and run the following command in your terminal:
104
-
105
- ```bash
106
- npm run dev
107
- ```
108
-
1
+ # Quick Start
2
+
3
+ This guide will walk you through creating, configuring, and running your own React documentation website from scratch in 5 minutes.
4
+
5
+ ## 1. Create the Project
6
+
7
+ Using the official scaffolding tool is the most efficient way. Open your terminal and run the following command:
8
+
9
+ ```bash
10
+ # This creates a project named "my-awesome-docs"
11
+ npx create-react-docs-ui@latest my-awesome-docs
12
+ ```
13
+
14
+ Next, enter the project directory and install the dependencies:
15
+
16
+ ```bash
17
+ cd my-awesome-docs
18
+ npm install
19
+ ```
20
+
21
+ ## 2. Organize Your Documents
22
+
23
+ All your documentation content is stored as Markdown files in the `public/docs/` directory.
24
+
25
+ - Open the `public/docs/en/` directory.
26
+ - You can modify the existing `index.md` and files under the `guide` directory, or create new `.md` files.
27
+
28
+ For example, let's create a new page. Create a new file named `about.md` in `public/docs/en/`:
29
+
30
+ ```markdown
31
+ ---
32
+ title: About Us
33
+ description: This is a page about our team.
34
+ ---
35
+
36
+ # About Us
37
+
38
+ We love open source and creation!
39
+ ```
40
+
41
+
42
+ ## 3. Configure the Website
43
+
44
+ Now, let's display the newly created page by modifying the configuration file.
45
+
46
+ Open the core configuration file `public/config/site.yaml`.
47
+
48
+ ### a. Modify Site Information
49
+
50
+ Update the `site` section to give your website a new title and logo.
51
+
52
+ ```yaml
53
+ site:
54
+ title: "My Awesome Docs"
55
+ description: "A website built with React Docs UI"
56
+ logo: "🚀" # You can use an emoji or an image path
57
+ ```
58
+
59
+ ### b. Add to the Navbar
60
+
61
+ In the `navbar.items` array, add a link for the "About" page. Remember to update the links for the English version.
62
+
63
+ ```yaml
64
+ navbar:
65
+ items:
66
+ - title: "Home"
67
+ link: "/en/"
68
+ - title: "Guide"
69
+ link: "/en/guide/introduction"
70
+ - title: "About" # New
71
+ link: "/en/about" # New
72
+ ```
73
+
74
+ ### c. Add to the Sidebar
75
+
76
+ To make the "About" page visible in the sidebar, we'll add a new entry in `sidebar.collections.guide.sections`. Make sure to use English paths.
77
+
78
+ ```yaml
79
+ sidebar:
80
+ collections:
81
+ guide:
82
+ sections:
83
+ - title: "Getting Started"
84
+ path: "/en/guide"
85
+ children:
86
+ - title: "Introduction"
87
+ path: "/en/guide/introduction"
88
+ - title: "Installation"
89
+ path: "/en/guide/installation"
90
+ - title: "Quick Start"
91
+ path: "/en/guide/quick-start"
92
+ # You can create a new section for the "About" page
93
+ - title: "About Us"
94
+ path: "/en/about"
95
+ children:
96
+ - title: "About"
97
+ path: "/en/about"
98
+ ```
99
+
100
+ ## 4. Launch the Website
101
+
102
+ Save all your changes and run the following command in your terminal:
103
+
104
+ ```bash
105
+ npm run dev
106
+ ```
107
+
109
108
  Your website should now be running at `http://localhost:5173`. Visit it, and you will see the updated title, logo, and the new "About" link in the navbar and sidebar. Congratulations, you have successfully mastered the basic workflow of React Docs UI!
@@ -1,122 +1,150 @@
1
- # 配置文件 (`site.yaml`) 详解
2
-
3
- `react-docs-ui` 的核心是其**配置驱动**的理念。你几乎可以通过 `public/config/site.yaml` 这一个文件来定义整个网站的外观和行为。本文档将详细解释每个配置项。
4
-
5
- ## 顶级配置项概览
6
-
7
- | 顶级字段 | 说明 |
8
- | :--- | :--- |
9
- | `site` | 网站的全局信息,如标题、描述、Logo。 |
10
- | `navbar` | 配置网站顶部的导航栏。 |
11
- | `sidebar` | 配置网站侧边栏的导航菜单。 |
12
- | `theme` | 配置网站的主题,如颜色、浅色/深色模式。 |
13
- | `footer` | 配置网站底部的页脚信息。 |
14
- | `toc` | 配置文章页面右侧的目录(Table of Contents)。 |
15
-
16
- ---
17
-
18
- ## `site`
19
-
20
- 网站的基础元数据配置。
21
-
22
- | 字段 | 说明 | 示例 |
23
- | :--- | :--- | :--- |
24
- | `title` | 网站标题,显示在浏览器标签页上。 | `"React Docs UI"` |
25
- | `description` | 网站描述,用于搜索引擎优化 (SEO)。 | `"一个 React 文档网站构建工具"` |
26
- | `logo` | 网站 Logo,显示在导航栏左上角。 | `"📚"` 或 `"/images/logo.png"` 或一个包含 `light` 和 `dark` 模式图片路径的对象 |
27
- | `author` | 网站作者。 | `"React Docs UI Team"` |
28
-
29
- **Logo 格式说明:**
30
- 1. **Emoji**: 直接使用一个表情符号,如 `"🚀"`。
31
- 2. **本地图片**: 指向 `public` 目录下的图片路径,如 `"/images/logo.png"`。
32
- 3. **亮/暗模式图片**: 一个对象,包含 `light` 和 `dark` 两个键,分别指向不同主题下的图片路径。
33
-
34
- ---
35
-
36
- ## `navbar`
37
-
38
- 顶部导航栏配置。
39
-
40
- | 字段 | 说明 |
41
- | :--- | :--- |
42
- | `items` | 导航项数组,定义了导航栏中显示的所有链接。 |
43
- | `actions` | (可选) 导航栏右侧的操作按钮,如 GitHub 链接。 |
44
-
45
- ### `navbar.items`
46
-
47
- | 字段 | 说明 | 示例 |
48
- | :--- | :--- | :--- |
49
- | `title` | 导航项的显示文本。 | `"指南"` |
50
- | `link` | 链接地址。内部链接以 `/` 开头。 | `"/guide/introduction"` |
51
- | `external` | (可选) `true` 表示为外部链接,将在新标签页打开。 | `true` |
52
-
53
- ---
54
-
55
- ## `sidebar`
56
-
57
- 侧边栏导航配置,是文档结构的核心。它使用 `collections` 来组织不同部分的内容。
58
-
59
- | 字段 | 说明 |
60
- | :--- | :--- |
61
- | `collections` | 一个对象,键是集合的名称(通常对应一级路由,如 `guide`),值是该集合的侧边栏配置。 |
62
-
63
- ### `sidebar.collections.<name>.sections`
64
-
65
- 每个集合包含一个 `sections` 数组,每个 `section` 代表一个可折叠的菜单组。
66
-
67
- | 字段 | 说明 | 示例 |
68
- | :--- | :--- | :--- |
69
- | `title` | 区域的标题。 | `"入门指南"` |
70
- | `path` | 区域的基础路径。当用户访问的 URL 以此路径开头时,该区域会自动展开并高亮。 | `"/guide"` |
71
- | `children` | 该区域下的子链接数组。 | |
72
-
73
- ### `sidebar.collections.<name>.sections.children`
74
-
75
- | 字段 | 说明 | 示例 |
76
- | :--- | :--- | :--- |
77
- | `title` | 子链接的显示文本。 | `"介绍"` |
78
- | `path` | 子链接的完整路径,指向一个具体的 Markdown 页面。 | `"/guide/introduction"` |
79
-
80
- ---
81
-
82
- ## `theme`
83
-
84
- 主题和外观配置。
85
-
86
- | 字段 | 说明 | 可选值 | 默认值 |
87
- | :--- | :--- | :--- | :--- |
88
- | `defaultMode` | 网站的默认主题模式。 | `'light'`, `'dark'`, `'system'` | `'system'` |
89
- | `allowToggle` | 是否允许用户切换主题。 | `true`, `false` | `true` |
90
-
91
- ---
92
-
93
- ## `footer`
94
-
95
- 页脚配置。
96
-
97
- | 字段 | 说明 | 示例 |
98
- | :--- | :--- | :--- |
99
- | `copyright` | 版权信息。`{year}` 会被替换为当前年份。 | `"Copyright © {year} My Company"` |
100
- | `repository` | (可选) 仓库信息,用于显示“在 GitHub 上编辑此页”等链接。 | |
101
- | `links` | (可选) 在页脚显示的额外链接列。 | |
102
- | `social` | (可选) 在页脚显示的社交媒体图标链接。 | |
103
-
104
- ### `footer.repository`
105
-
106
- | 字段 | 说明 | 示例 |
107
- | :--- | :--- | :--- |
108
- | `url` | 仓库的 URL。 | `"https://github.com/user/repo"` |
109
- | `branch` | 文档所在的 Git 分支。 | `"main"` |
110
- | `dir` | 文档文件在仓库中的根目录。 | `"docs/src"` |
111
-
112
- ---
113
-
114
- ## `toc` (Table of Contents)
115
-
116
- 文章页面右侧的目录配置。
117
-
118
- | 字段 | 说明 | 示例 |
119
- | :--- | :--- | :--- |
120
- | `enabled` | 是否启用页面目录功能。 | `true` |
121
- | `maxLevel` | 在目录中显示的最大标题级别(h1-h6)。 | `3` |
122
- | `title` | 目录组件的标题。 | `"本页内容"` |
1
+ # 配置文件(`site.yaml`)字段说明
2
+
3
+ 项目遵循“配置驱动”。绝大多数行为由 `public/config/site.yaml` 决定。下面用表格逐项说明所有字段。
4
+
5
+ ## 顶级键
6
+ | 键 | 作用 |
7
+ | :-- | :-- |
8
+ | `site` | 全局元信息(标题、描述、Logo、作者) |
9
+ | `navbar` | 顶部导航(开关、导航项、操作按钮) |
10
+ | `sidebar` | 左侧导航树(集合/分组/子项) |
11
+ | `theme` | 主题配置(默认模式、是否允许切换) |
12
+ | `toc` | 文章右侧目录(开关、层级、标题) |
13
+ | `footer` | 页脚(链接、社交、仓库信息) |
14
+ | `pwa` | PWA 设置(预留/可选) |
15
+
16
+ ---
17
+
18
+ ## `site`
19
+ | 字段 | 类型 | 说明 | 示例 |
20
+ | :-- | :-- | :-- | :-- |
21
+ | `title` | string | 网站标题 | `"React Docs UI 示例"` |
22
+ | `description` | string | 简短网站描述(SEO) | `"简单漂亮的文档站"` |
23
+ | `logo` | string 或 object | 网站 Logo。字符串可为 emoji 或图片路径;对象可分别设置亮/暗图标 | `"📚"`、`"/images/logo.png"`、或 `{ light: "/images/favicon.svg", dark: "/images/favicon-dark.svg" }` |
24
+ | `author` | string | 作者或组织 | `"React Docs UI Team"` |
25
+
26
+ Logo 支持:
27
+ - Emoji:`"🚀"`
28
+ - 公共路径或 URL:`"/images/logo.png"`
29
+ - 明/暗主题对象:`{ light, dark }`
30
+
31
+ ---
32
+
33
+ ## `navbar`
34
+ | 字段 | 类型 | 说明 |
35
+ | :-- | :-- | :-- |
36
+ | `showLogo` | boolean | 是否显示左上角 Logo |
37
+ | `showTitle` | boolean | 是否显示站点标题 |
38
+ | `showLanguageSwitcher` | boolean | 是否显示语言切换 |
39
+ | `items` | array<Item> | 主导航链接 |
40
+ | `actions` | array<Action> | 右侧操作按钮(如 GitHub) |
41
+
42
+ Item
43
+ | 字段 | 类型 | 说明 | 示例 |
44
+ | :-- | :-- | :-- | :-- |
45
+ | `title` | string | 链接文字 | `"指南"` |
46
+ | `link` | string | 路径或 URL。内部路径以 `/` 开头 | `"/guide"` |
47
+ | `external` | boolean(可选) | 外部链接新开标签 |
48
+ | `visible` | boolean(可选) | 条件展示 |
49
+
50
+ Action
51
+ | 字段 | 类型 | 说明 | 示例 |
52
+ | :-- | :-- | :-- | :-- |
53
+ | `type` | `"github"`/`"custom"`(可选) | 预设或自定义动作 | `"github"` |
54
+ | `title` | string(可选) | 自定义动作按钮文案 |
55
+ | `link` | string | 目标链接 |
56
+ | `icon` | string(可选) | 自定义动作图标名 |
57
+ | `enabled` | boolean(可选) | 是否启用 |
58
+
59
+ ---
60
+
61
+ ## `sidebar`
62
+ | 字段 | 类型 | 说明 |
63
+ | :-- | :-- | :-- |
64
+ | `enabled` | boolean(可选) | 全局开启/关闭侧边栏 |
65
+ | `collections` | record<string, Collection> | 顶级集合映射(如 `guide`) |
66
+ | `sections` | Section[] (兼容,可选) | 旧版单树结构 |
67
+
68
+ Collection
69
+ | 字段 | 类型 | 说明 |
70
+ | :-- | :-- | :-- |
71
+ | `sections` | Section[] | 一组可折叠分组 |
72
+
73
+ Section
74
+ | 字段 | 类型 | 说明 | 示例 |
75
+ | :-- | :-- | :-- | :-- |
76
+ | `title` | string | 分组标题 | `"快速开始"` |
77
+ | `path` | string | 访问该前缀将自动展开/高亮 | `"/guide"` |
78
+ | `children` | Child[](可选) | 该分组下的子链接 |
79
+
80
+ Child
81
+ | 字段 | 类型 | 说明 | 示例 |
82
+ | :-- | :-- | :-- | :-- |
83
+ | `title` | string | 子链接文字 | `"介绍"` |
84
+ | `path` | string | 完整页面路径 | `"/guide/introduction"` |
85
+
86
+ ---
87
+
88
+ ## `theme`
89
+ | 字段 | 类型 | 说明 | 可选值 | 默认值 |
90
+ | :-- | :-- | :-- | :-- | :-- |
91
+ | `defaultMode` | string | 默认主题模式 | `light`/`dark`/`auto` | `auto` |
92
+ | `allowToggle` | boolean | 是否允许用户切换主题 | `true`/`false` | `true` |
93
+
94
+ ---
95
+
96
+ ## `toc`
97
+ | 字段 | 类型 | 说明 | 示例 |
98
+ | :-- | :-- | :-- | :-- |
99
+ | `enabled` | boolean | 是否启用页面目录 | `true` |
100
+ | `maxLevel` | number (1-6) | 展示的最大标题层级 | `3` |
101
+ | `title` | string | 目录标题 | `"本页内容"` |
102
+
103
+ 说明:具体锚点与是否显示也可能受页面 Frontmatter 影响。
104
+
105
+ ---
106
+
107
+ ## `footer`
108
+ | 字段 | 类型 | 说明 |
109
+ | :-- | :-- | :-- |
110
+ | `enabled` | boolean | 是否显示页脚 |
111
+ | `copyright` | string | 版权文案 |
112
+ | `repository` | Repository(可选) | 仓库信息(如“在 GitHub 上编辑此页”) |
113
+ | `lastUpdated` | string(可选) | 站点/内容最近更新时间 |
114
+ | `links` | Link[](可选) | 页脚链接列 |
115
+ | `social` | Social[](可选) | 社交图标链接 |
116
+
117
+ Repository
118
+ | 字段 | 类型 | 说明 | 示例 |
119
+ | :-- | :-- | :-- | :-- |
120
+ | `url` | string | 仓库地址 | `"https://github.com/user/repo"` |
121
+ | `branch` | string | 文档所在分支 | `"main"` |
122
+
123
+ Link
124
+ | 字段 | 类型 | 说明 |
125
+ | :-- | :-- | :-- |
126
+ | `title` | string | 链接标题 |
127
+ | `link` | string | 路径或 URL |
128
+ | `external` | boolean(可选) | 新开标签 |
129
+
130
+ Social
131
+ | 字段 | 类型 | 说明 |
132
+ | :-- | :-- | :-- |
133
+ | `name` | string | 平台名称(如 `github`/`twitter`/`bilibili`) |
134
+ | `url` | string | 个人页或链接 |
135
+ | `icon` | string | 图标名 |
136
+
137
+ ---
138
+
139
+ ## `pwa`(可选)
140
+ | 字段 | 类型 | 说明 |
141
+ | :-- | :-- | :-- |
142
+ | `enabled` | boolean | 是否启用 PWA(预留) |
143
+ | `name` | string | 应用名 |
144
+ | `shortName` | string | 应用短名 |
145
+ | `description` | string | 应用描述 |
146
+ | `themeColor` | string | 主题色 |
147
+ | `backgroundColor` | string | 背景色 |
148
+
149
+ ---
150
+
@@ -1,109 +1,108 @@
1
- # 快速上手
2
-
3
- 本指南将引导你在 5 分钟内,从零开始创建、配置并运行一个属于你自己的 React 文档网站。
4
-
5
- ## 1. 创建项目
6
-
7
- 使用官方脚手架是最高效的方式。打开你的终端,运行以下命令:
8
-
9
- ```bash
10
- # 这会创建一个名为 "my-awesome-docs" 的项目
11
- npx create-react-docs-ui@latest my-awesome-docs
12
- ```
13
-
14
- 然后,进入项目目录并安装依赖:
15
-
16
- ```bash
17
- cd my-awesome-docs
18
- npm install
19
- ```
20
-
21
- ## 2. 组织你的文档
22
-
23
- 所有的文档内容都以 Markdown 文件的形式存放在 `public/docs/` 目录下。
24
-
25
- - 打开 `public/docs/zh-cn/` 目录。
26
- - 你可以修改现有的 `index.md` 和 `guide` 目录下的文件,或者创建新的 `.md` 文件。
27
-
28
- 例如,我们来创建一个新页面。在 `public/docs/zh-cn/` 下新建一个 `about.md` 文件:
29
-
30
- ```markdown
31
- ---
32
- title: 关于我们
33
- description: 这是一个关于我们团队的页面。
34
- ---
35
-
36
- # 关于我们
37
-
38
- 我们热爱开源和创造!
39
- ```
40
-
41
- **注意**: 你可以在 Markdown 文件顶部使用 `frontmatter` 来定义页面标题 (`title`) 和描述 (`description`)。
42
-
43
- ## 3. 配置网站
44
-
45
- 现在,让我们通过修改配置文件来展示新创建的页面。
46
-
47
- 打开核心配置文件 `public/config/site.yaml`。
48
-
49
- ### a. 修改网站信息
50
-
51
- 更新 `site` 部分,给你的网站一个新标题和 Logo。
52
-
53
- ```yaml
54
- site:
55
- title: "我的超赞文档"
56
- description: "一个使用 React Docs UI 构建的网站"
57
- logo: "🚀" # 你可以使用 emoji 或图片路径
58
- ```
59
-
60
- ### b. 添加到导航栏
61
-
62
- 在 `navbar.items` 数组中,为“关于”页面添加一个链接。
63
-
64
- ```yaml
65
- navbar:
66
- items:
67
- - title: "首页"
68
- link: "/zh-cn/"
69
- - title: "指南"
70
- link: "/zh-cn/guide/introduction"
71
- - title: "关于" # 新增
72
- link: "/zh-cn/about" # 新增
73
- ```
74
-
75
- ### c. 添加到侧边栏
76
-
77
- 为了让“关于”页面在侧边栏也可见,我们在 `sidebar.collections.guide.sections` 中添加一个新条目。
78
-
79
- ```yaml
80
- sidebar:
81
- collections:
82
- guide:
83
- sections:
84
- - title: "快速开始"
85
- path: "/zh-cn/guide"
86
- children:
87
- - title: "介绍"
88
- path: "/zh-cn/guide/introduction"
89
- - title: "安装"
90
- path: "/zh-cn/guide/installation"
91
- - title: "快速上手"
92
- path: "/zh-cn/guide/quick-start"
93
- # 你可以为 "关于" 页面创建一个新的 section
94
- - title: "关于我们"
95
- path: "/zh-cn/about"
96
- children:
97
- - title: "关于"
98
- path: "/zh-cn/about"
99
- ```
100
-
101
- ## 4. 启动网站
102
-
103
- 保存你的所有修改,然后在终端运行:
104
-
105
- ```bash
106
- npm run dev
107
- ```
108
-
1
+ # 快速上手
2
+
3
+ 本指南将引导你在 5 分钟内,从零开始创建、配置并运行一个属于你自己的 React 文档网站。
4
+
5
+ ## 1. 创建项目
6
+
7
+ 使用官方脚手架是最高效的方式。打开你的终端,运行以下命令:
8
+
9
+ ```bash
10
+ # 这会创建一个名为 "my-awesome-docs" 的项目
11
+ npx create-react-docs-ui@latest my-awesome-docs
12
+ ```
13
+
14
+ 然后,进入项目目录并安装依赖:
15
+
16
+ ```bash
17
+ cd my-awesome-docs
18
+ npm install
19
+ ```
20
+
21
+ ## 2. 组织你的文档
22
+
23
+ 所有的文档内容都以 Markdown 文件的形式存放在 `public/docs/` 目录下。
24
+
25
+ - 打开 `public/docs/zh-cn/` 目录。
26
+ - 你可以修改现有的 `index.md` 和 `guide` 目录下的文件,或者创建新的 `.md` 文件。
27
+
28
+ 例如,我们来创建一个新页面。在 `public/docs/zh-cn/` 下新建一个 `about.md` 文件:
29
+
30
+ ```markdown
31
+ ---
32
+ title: 关于我们
33
+ description: 这是一个关于我们团队的页面。
34
+ ---
35
+
36
+ # 关于我们
37
+
38
+ 我们热爱开源和创造!
39
+ ```
40
+
41
+
42
+ ## 3. 配置网站
43
+
44
+ 现在,让我们通过修改配置文件来展示新创建的页面。
45
+
46
+ 打开核心配置文件 `public/config/site.yaml`。
47
+
48
+ ### a. 修改网站信息
49
+
50
+ 更新 `site` 部分,给你的网站一个新标题和 Logo。
51
+
52
+ ```yaml
53
+ site:
54
+ title: "我的超赞文档"
55
+ description: "一个使用 React Docs UI 构建的网站"
56
+ logo: "🚀" # 你可以使用 emoji 或图片路径
57
+ ```
58
+
59
+ ### b. 添加到导航栏
60
+
61
+ 在 `navbar.items` 数组中,为“关于”页面添加一个链接。
62
+
63
+ ```yaml
64
+ navbar:
65
+ items:
66
+ - title: "首页"
67
+ link: "/zh-cn/"
68
+ - title: "指南"
69
+ link: "/zh-cn/guide/introduction"
70
+ - title: "关于" # 新增
71
+ link: "/zh-cn/about" # 新增
72
+ ```
73
+
74
+ ### c. 添加到侧边栏
75
+
76
+ 为了让“关于”页面在侧边栏也可见,我们在 `sidebar.collections.guide.sections` 中添加一个新条目。
77
+
78
+ ```yaml
79
+ sidebar:
80
+ collections:
81
+ guide:
82
+ sections:
83
+ - title: "快速开始"
84
+ path: "/zh-cn/guide"
85
+ children:
86
+ - title: "介绍"
87
+ path: "/zh-cn/guide/introduction"
88
+ - title: "安装"
89
+ path: "/zh-cn/guide/installation"
90
+ - title: "快速上手"
91
+ path: "/zh-cn/guide/quick-start"
92
+ # 你可以为 "关于" 页面创建一个新的 section
93
+ - title: "关于我们"
94
+ path: "/zh-cn/about"
95
+ children:
96
+ - title: "关于"
97
+ path: "/zh-cn/about"
98
+ ```
99
+
100
+ ## 4. 启动网站
101
+
102
+ 保存你的所有修改,然后在终端运行:
103
+
104
+ ```bash
105
+ npm run dev
106
+ ```
107
+
109
108
  你的网站现在应该运行在 `http://localhost:5173` 上了。访问它,你会看到更新后的标题、Logo,以及导航栏和侧边栏中新增的“关于”链接。恭喜你,你已经成功掌握了 React Docs UI 的基本工作流程!