docs: refine directory-structure guide (close #1924)

This commit is contained in:
meteorlxy
2019-11-27 17:34:04 +08:00
parent b00b277afd
commit 23ce8668d8
2 changed files with 33 additions and 11 deletions
@@ -54,13 +54,24 @@ When customizing `templates/ssr.html`, or `templates/dev.html`, its best to e
## Default Page Routing
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:
```json
{
"scripts": {
"dev": "vuepress dev docs",
"build": "vuepress build docs"
}
}
```
For the above directory structure, the default page routing paths are as follows:
| Relative Path | Page Routing |
|---|---|
| `/README.md` | `/` |
| `/guide/README.md` | `/guide/` |
| `/config.md` | `/config.html` |
| Relative Path | Page Routing |
|--------------------|----------------|
| `/README.md` | `/` |
| `/guide/README.md` | `/guide/` |
| `/config.md` | `/config.html` |
**Also see:**
@@ -56,11 +56,22 @@ VuePress 遵循 **“约定优于配置”** 的原则,推荐的目录结构
## 默认的页面路由
外,对于上述的目录结构,默认页面路由地址如下
处我们把 `docs` 目录作为 `targetDir` (参考 [命令行接口](../api/cli.md#基本用法)),下面所有的“文件的相对路径”都是相对于 `docs` 目录的。在项目根目录下的 `package.json` 中添加 `scripts`
| 文件的相对路径 | 页面路由地址 |
|---|---|
| `/README.md` | `/` |
| `/guide/README.md` | `/guide/` |
| `/config.md` | `/config.html` |
```json
{
"scripts": {
"dev": "vuepress dev docs",
"build": "vuepress build docs"
}
}
```
对于上述的目录结构,默认页面路由地址如下:
| 文件的相对路径 | 页面路由地址 |
|--------------------|----------------|
| `/README.md` | `/` |
| `/guide/README.md` | `/guide/` |
| `/config.md` | `/config.html` |