Skip to content

Commit 23ce866

Browse files
committed
docs: refine directory-structure guide (close #1924)
1 parent b00b277 commit 23ce866

File tree

2 files changed

+33
-11
lines changed

2 files changed

+33
-11
lines changed

packages/docs/docs/guide/directory-structure.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,13 +54,24 @@ When customizing `templates/ssr.html`, or `templates/dev.html`, it’s best to e
5454

5555
## Default Page Routing
5656

57+
Here we take `docs` directory as the `targetDir` (See [Command-line Interface](../api/cli.md#usage)), and all the "Relative Path" below are relative to `docs` directory. Add `scripts` in `package.json` that located in the project root directory:
58+
59+
```json
60+
{
61+
"scripts": {
62+
"dev": "vuepress dev docs",
63+
"build": "vuepress build docs"
64+
}
65+
}
66+
```
67+
5768
For the above directory structure, the default page routing paths are as follows:
5869

59-
| Relative Path | Page Routing |
60-
|---|---|
61-
| `/README.md` | `/` |
62-
| `/guide/README.md` | `/guide/` |
63-
| `/config.md` | `/config.html` |
70+
| Relative Path | Page Routing |
71+
|--------------------|----------------|
72+
| `/README.md` | `/` |
73+
| `/guide/README.md` | `/guide/` |
74+
| `/config.md` | `/config.html` |
6475

6576
**Also see:**
6677

packages/docs/docs/zh/guide/directory-structure.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,22 @@ VuePress 遵循 **“约定优于配置”** 的原则,推荐的目录结构
5656

5757
## 默认的页面路由
5858

59-
此外,对于上述的目录结构,默认页面路由地址如下
59+
此处我们把 `docs` 目录作为 `targetDir` (参考 [命令行接口](../api/cli.md#基本用法)),下面所有的“文件的相对路径”都是相对于 `docs` 目录的。在项目根目录下的 `package.json` 中添加 `scripts`
6060

61-
| 文件的相对路径 | 页面路由地址 |
62-
|---|---|
63-
| `/README.md` | `/` |
64-
| `/guide/README.md` | `/guide/` |
65-
| `/config.md` | `/config.html` |
61+
```json
62+
{
63+
"scripts": {
64+
"dev": "vuepress dev docs",
65+
"build": "vuepress build docs"
66+
}
67+
}
68+
```
69+
70+
对于上述的目录结构,默认页面路由地址如下:
71+
72+
| 文件的相对路径 | 页面路由地址 |
73+
|--------------------|----------------|
74+
| `/README.md` | `/` |
75+
| `/guide/README.md` | `/guide/` |
76+
| `/config.md` | `/config.html` |
6677

0 commit comments

Comments
 (0)