From 504268c75ff8645e10853e1f9a0f24ce81490d1f Mon Sep 17 00:00:00 2001 From: patzick <13100280+patzick@users.noreply.github.com> Date: Tue, 24 Apr 2018 09:18:23 +0200 Subject: [PATCH] feat: support disable navbar via front matter (close: #187) (#232) --- docs/default-theme-config/README.md | 16 +++++++++++++++- lib/default-theme/Layout.vue | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/default-theme-config/README.md b/docs/default-theme-config/README.md index 7651e20acc..e8a35fa12a 100644 --- a/docs/default-theme-config/README.md +++ b/docs/default-theme-config/README.md @@ -33,7 +33,11 @@ Any additional content after the `YAML front matter` will be parsed as normal ma If you want to use a completely custom homepage layout, you can also use a [Custom Layout](#custom-layout-for-specific-pages). -## Navbar Links +## Navbar + +The Navbar may contain your page title, [Search Box](#search-box), [Navbar Links](#navbar-links), [Languages](/guide/i18n.html#internationalization) and [Repository link](/default-theme-config/#git-repo-and-edit-links) - all of them depends on your configuration. + +### Navbar Links You can add links to the navbar via `themeConfig.nav`: @@ -86,6 +90,16 @@ module.exports = { } ``` +### Disable the Navbar + +You can disable the navbar for a specific page via `YAML front matter`: + +``` yaml +--- +navbar: false +--- +``` + ## Sidebar To enable the sidebar, use `themeConfig.sidebar`. The basic configuration expects an Array of links: diff --git a/lib/default-theme/Layout.vue b/lib/default-theme/Layout.vue index de3b9add8f..bcb6436daa 100644 --- a/lib/default-theme/Layout.vue +++ b/lib/default-theme/Layout.vue @@ -41,6 +41,8 @@ export default { computed: { shouldShowNavbar () { const { themeConfig } = this.$site + const { frontmatter } = this.$page + if (frontmatter.navbar === false) return false return ( this.$title || themeConfig.logo ||