Skip to content

Commit 046c553

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

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

docs/configuration.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ 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
};
@@ -707,6 +709,20 @@ TLDR: start with `hash` routing (the default). If you feel adventurous, learn
707709
how to configure a server, then switch to `history` mode for better experience
708710
without the `#` in the URL and SEO optimization.
709711

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

0 commit comments

Comments
 (0)