Skip to content

Commit

Permalink
add a note about making an alias for _sidebar.md when using `rout…
Browse files Browse the repository at this point in the history
…erMode: 'history'`
  • Loading branch information
trusktr committed Jan 23, 2023
1 parent 3feebc0 commit e07060a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,16 @@ window.$docsify = {
'/zh-cn/changelog': '/changelog',
'/changelog':
'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG',

// You may need this if you use routerMode:'history'.
'/.*/_sidebar.md': '/_sidebar.md', // See #301
},
};
```

> **Note** If you change [`routerMode`](#routermode) to `'history'`, you may
> want to configure an alias for your `_sidebar.md` and `_navbar.md` files.
## auto2top

- Type: `Boolean`
Expand Down Expand Up @@ -707,6 +712,20 @@ TLDR: start with `hash` routing (the default). If you feel adventurous, learn
how to configure a server, then switch to `history` mode for better experience
without the `#` in the URL and SEO optimization.

> **Note** If you use `routerMode: 'history'`, you may want to add an
> [`alias`](#alias) to make your `_sidebar.md` and `_navbar.md` files always be
> loaded no matter which path is being visited.
>
> ```js
> window.$docsify = {
> routerMode: 'history',
> alias: {
> '/.*/_sidebar.md': '/_sidebar.md',
> '/.*/_navbar.md': '/_navbar.md',
> },
> };
> ```
## routes
- Type: `Object`
Expand Down

0 comments on commit e07060a

Please sign in to comment.