diff --git a/docs/configuration.md b/docs/configuration.md index 7a65553a3..f7a9d32d4 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -629,3 +629,15 @@ window.$docsify = { topMargin: 90, // default: 0 }; ``` + +## loadNavbarOnCover + +- type: `Boolean` + +If set to `false`, the navbar will not be shown on the cover. + +```js +window.$docsify = { + loadNavbarOnCover: false, +}; +``` diff --git a/src/core/config.js b/src/core/config.js index 2d23f5db2..d40cec814 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -35,6 +35,7 @@ export default function(vm) { crossOriginLinks: [], relativePath: false, topMargin: 0, + loadNavbarOnCover: true, }, typeof window.$docsify === 'function' ? window.$docsify(vm) diff --git a/src/core/fetch/index.js b/src/core/fetch/index.js index 1853a0297..b24f8d951 100644 --- a/src/core/fetch/index.js +++ b/src/core/fetch/index.js @@ -104,7 +104,12 @@ export function fetchMixin(proto) { proto._fetch = function(cb = noop) { const { path, query } = this.route; const qs = stringifyQuery(query, ['id']); - const { loadNavbar, requestHeaders, loadSidebar } = this.config; + const { + loadNavbar, + requestHeaders, + loadSidebar, + loadNavbarOnCover, + } = this.config; // Abort last request const file = this.router.getFile(path); @@ -128,7 +133,15 @@ export function fetchMixin(proto) { ); // Load nav - loadNavbar && + if (loadNavbar) { + // default show the nav + document.querySelector('.app-nav').style.display = 'inline'; + if (path === '/' && !loadNavbarOnCover) { + // hidden nav on cover + document.querySelector('.app-nav').style.display = 'none'; + return; + } + loadNested( path, qs, @@ -137,6 +150,7 @@ export function fetchMixin(proto) { this, true ); + } }; proto._fetchCover = function() {