Skip to content

Commit e07060a

Browse files
committed
add a note about making an alias for _sidebar.md when using routerMode: 'history'
1 parent 3feebc0 commit e07060a

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

docs/configuration.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,16 @@ window.$docsify = {
4444
'/zh-cn/changelog': '/changelog',
4545
'/changelog':
4646
'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG',
47+
48+
// You may need this if you use routerMode:'history'.
4749
'/.*/_sidebar.md': '/_sidebar.md', // See #301
4850
},
4951
};
5052
```
5153

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

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

715+
> **Note** If you use `routerMode: 'history'`, you may want to add an
716+
> [`alias`](#alias) to make your `_sidebar.md` and `_navbar.md` files always be
717+
> loaded no matter which path is being visited.
718+
>
719+
> ```js
720+
> window.$docsify = {
721+
> routerMode: 'history',
722+
> alias: {
723+
> '/.*/_sidebar.md': '/_sidebar.md',
724+
> '/.*/_navbar.md': '/_navbar.md',
725+
> },
726+
> };
727+
> ```
728+
710729
## routes
711730
712731
- Type: `Object`

0 commit comments

Comments
 (0)