Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Navbar disabling option - global #246

Merged
merged 3 commits into from
Apr 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docs/default-theme-config/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ If you want to use a completely custom homepage layout, you can also use a [Cust

## Navbar

The Navbar may contain yourg page title, [Search Box](#search-box), [Navbar Links](#navbar-links), [Languages](../guide/i18n.md) and [Repository Link](#git-repo-and-edit-links), all of them depends on your configuration.
The Navbar may contain your page title, [Search Box](#search-box), [Navbar Links](#navbar-links), [Languages](../guide/i18n.md) and [Repository Link](#git-repo-and-edit-links), all of them depends on your configuration.

### Navbar Links

Expand Down Expand Up @@ -92,6 +92,17 @@ module.exports = {

### Disable the Navbar

To disable the navbar globally, use `themeConfig.navbar`.

``` js
// .vuepress/config.js
module.exports = {
themeConfig: {
navbar: false
}
}
```

You can disable the navbar for a specific page via `YAML front matter`:

``` yaml
Expand Down
6 changes: 5 additions & 1 deletion lib/default-theme/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ export default {
shouldShowNavbar () {
const { themeConfig } = this.$site
const { frontmatter } = this.$page
if (frontmatter.navbar === false) return false
if (
frontmatter.navbar === false ||
themeConfig.navbar === false) {
return false
}
return (
this.$title ||
themeConfig.logo ||
Expand Down