From 23ce8668d827cbb375dbad07fdf5a51f661ac217 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Wed, 27 Nov 2019 17:33:21 +0800 Subject: [PATCH] docs: refine directory-structure guide (close #1924) --- .../docs/docs/guide/directory-structure.md | 21 +++++++++++++---- .../docs/docs/zh/guide/directory-structure.md | 23 ++++++++++++++----- 2 files changed, 33 insertions(+), 11 deletions(-) diff --git a/packages/docs/docs/guide/directory-structure.md b/packages/docs/docs/guide/directory-structure.md index 091f82ea..09213eea 100644 --- a/packages/docs/docs/guide/directory-structure.md +++ b/packages/docs/docs/guide/directory-structure.md @@ -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:** diff --git a/packages/docs/docs/zh/guide/directory-structure.md b/packages/docs/docs/zh/guide/directory-structure.md index fe0e6c40..733c75e9 100644 --- a/packages/docs/docs/zh/guide/directory-structure.md +++ b/packages/docs/docs/zh/guide/directory-structure.md @@ -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` |