Skip to content

Commit f70c9b1

Browse files
committed
feat: add loadNavbarOnCover configuration
fix Update docs.index.html fix fix fix Update docs.index.html fix Update docs.index.html fix remove test Update docs.index.html update
1 parent ae45b32 commit f70c9b1

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

docs/configuration.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,3 +629,15 @@ window.$docsify = {
629629
topMargin: 90, // default: 0
630630
};
631631
```
632+
633+
## loadNavbarOnCover
634+
635+
- type: `Boolean`
636+
637+
If set to `false`, the navbar will not be shown on the cover.
638+
639+
```js
640+
window.$docsify = {
641+
loadNavbarOnCover: false,
642+
};
643+
```

src/core/config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default function(vm) {
3535
crossOriginLinks: [],
3636
relativePath: false,
3737
topMargin: 0,
38+
loadNavbarOnCover: true,
3839
},
3940
typeof window.$docsify === 'function'
4041
? window.$docsify(vm)

src/core/fetch/index.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,12 @@ export function fetchMixin(proto) {
104104
proto._fetch = function(cb = noop) {
105105
const { path, query } = this.route;
106106
const qs = stringifyQuery(query, ['id']);
107-
const { loadNavbar, requestHeaders, loadSidebar } = this.config;
107+
const {
108+
loadNavbar,
109+
requestHeaders,
110+
loadSidebar,
111+
loadNavbarOnCover,
112+
} = this.config;
108113
// Abort last request
109114

110115
const file = this.router.getFile(path);
@@ -128,7 +133,15 @@ export function fetchMixin(proto) {
128133
);
129134

130135
// Load nav
131-
loadNavbar &&
136+
if (loadNavbar) {
137+
// default show the nav
138+
document.querySelector('.app-nav').style.display = 'inline';
139+
if (path === '/' && !loadNavbarOnCover) {
140+
// hidden nav on cover
141+
document.querySelector('.app-nav').style.display = 'none';
142+
return;
143+
}
144+
132145
loadNested(
133146
path,
134147
qs,
@@ -137,6 +150,7 @@ export function fetchMixin(proto) {
137150
this,
138151
true
139152
);
153+
}
140154
};
141155

142156
proto._fetchCover = function() {

0 commit comments

Comments
 (0)