docs: update alias fixed #372

This commit is contained in:
qingwei.li 2018-01-31 13:13:16 +08:00
parent 9d5f561b28
commit bedc262d83
4 changed files with 41 additions and 3 deletions

View File

@ -53,6 +53,19 @@ Als Zweites erstellst du eine Datei namens `_sidebar.md`:
`_sidebar.md` wird in jedem Verzeichnislevel geladen. Sollte das aktuelle Verzeichnis keine Datei namens `_sidebar.md` haben, so sucht **docsify** in den übergeordneten Ordnern. Wenn du z.B. im Moment im Verzeichnis `/guide/quick-start` bist, so wird `_sidebar.md` von der Datei `/guide/_sidebar.md` geladen.
You can specify `alias` to avoid unnecessary fallback.
```html
<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
}
}
</script>
```
## Inhaltsverzeichnis
Eine angepasste Seitenleist kann auch automatisch ein Inhaltsverzeichnis generieren, indem ein `subMaxLevel` gesetzt wird, vergleiche [sub-max-level Einstellungen](configuration.md#sub-max-level).

View File

@ -14,8 +14,8 @@ It is recommended that you save your files to the `./docs` subfolder of the `mas
![github pages](_images/deploy-github-pages.png)
!> You can also save files in the root directory and select `master branch`.
!> You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch
!> You can also save files in the root directory and select `master branch`.
You'll need to place a `.nojekyll` file in the deploy location (such as `/docs` or the gh-pages branch
## GitLab Pages

View File

@ -53,10 +53,22 @@ You need to create a `.nojekyll` in `./docs` to prevent GitHub Pages from ignori
`_sidebar.md` is loaded from each level directory. If the current directory doesn't have `_sidebar.md`, it will fall back to the parent directory. If, for example, the current path is `/guide/quick-start`, the `_sidebar.md` will be loaded from `/guide/_sidebar.md`.
You can specify `alias` to avoid unnecessary fallback.
```html
<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
}
}
</script>
```
## Table of Contents
Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files.
Once you've created `_sidebar.md`, the sidebar content is automatically generated based on the headers in the markdown files.
A custom sidebar can also automatically generate a table of contents by setting a `subMaxLevel`, compare [sub-max-level configuration](configuration.md#sub-max-level).

View File

@ -49,6 +49,19 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide
`_sidebar.md` 的加载逻辑是从每层目录下获取文件,如果当前目录不存在该文件则回退到上一级目录。例如当前路径为 `/zh-cn/more-pages` 则从 `/zh-cn/_sidebar.md` 获取文件,如果不存在则从 `/_sidebar.md` 获取。
当然你也可以配置 `alias` 避免不必要的回退过程。
```html
<script>
window.$docsify = {
loadSidebar: true,
alias: {
'/.*/_sidebar.md': '/_sidebar.md'
}
}
</script>
```
## 显示目录
自定义侧边栏同时也可以开启目录功能。设置 `subMaxLevel` 配置项,具体介绍见 [配置项#sub-max-level](zh-cn/configuration#sub-max-level)。