mirror of
https://github.com/wahyd4/vuepress.git
synced 2026-08-09 05:16:23 +10:00
docs: refine directory-structure guide (close #1924)
This commit is contained in:
@@ -54,13 +54,24 @@ When customizing `templates/ssr.html`, or `templates/dev.html`, it’s 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` |
|
||||
|
||||
|
||||
Reference in New Issue
Block a user