Vuepress: sidebarDepth: 0 not working in JSON

Created on 28 Apr 2020  ·  2Comments  ·  Source: vuejs/vuepress




  • [x] I confirm that this is an issue rather than a question.




Bug report

When using sidebarDepth: 0 in a page YAML the header links keep being displayed.

Steps to reproduce

Add a sidebarDepth to a element in the sidebar object.
If this element has h2 headers (created with ## in markdown), they will appear as a submenu in the navbar.

config.json

{
sidebar: {
'/resources/': [
        {
          title: '📦 Resources',
          path: '/resources/',
          collapsable: false,
          children: [
            '/resources/sdks',
            {
              title: 'FAQ',
              path: '/resources/faq.md',
              sidebarDepth: 0,
            },
            '/resources/contact',
          ],
        },
 ]
}

}

What is expected?

The h2 title should not appear in the sidebar.

What is actually happening?

The h2 titles does appear in the sidebar.

preview of the sidebar:
Screenshot 2020-04-28 at 10 32 35

sample of code from faq.md:

# FAQ

This FAQ is still a work in progress.<br>
If you have any questions we want to hear from you. Your feedback will help us improve this page!

## Table of contents
...

Other relevant information

similar issue: #1701

  • Output of npx vuepress info in my VuePress project:
Environment Info:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (6) x64 Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz
  Binaries:
    Node: 14.0.0 - /usr/local/bin/node
    Yarn: 1.21.1 - ~/.yarn/bin/yarn
    npm: 6.14.4 - /usr/local/bin/npm
  Browsers:
    Chrome: 81.0.4044.122
    Firefox: 72.0.2
    Safari: 13.1
  npmPackages:
    @vuepress/core:  1.4.1 
    @vuepress/theme-default:  1.4.1 
    vuepress: ^1.4.1 => 1.4.1 
  npmGlobalPackages:
    vuepress: Not Found

All 2 comments

你配置错了。
sidebarDepth 不是 sidebar 的配置属性。
image

image

你也可以在 md 文件开头加这一句:

sidebarDepth: 0
---

## title
blabla......

It actually is @koibi2. At least that is what the documentation claims:
https://vuepress.vuejs.org/theme/default-theme-config.html#sidebar-groups

Because I have exactly the same problem. It works totally fine fine on the top level themeConfig.sidebarDepth but it is not possible to overwrite it in a Sidebar Group as described in the above link.

So I can not have it as default set to 2 and then overwrite it for some groups to 0.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tinchox5 picture tinchox5  ·  3Comments

FadySamirSadek picture FadySamirSadek  ·  3Comments

shaodahong picture shaodahong  ·  3Comments

genedronek picture genedronek  ·  3Comments

ynnelson picture ynnelson  ·  3Comments