Skip to content

sidebarDepth: 0 not working in JSON #2347

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

Open
1 task done
bidoubiwa opened this issue Apr 28, 2020 · 2 comments
Open
1 task done

sidebarDepth: 0 not working in JSON #2347

bidoubiwa opened this issue Apr 28, 2020 · 2 comments

Comments

@bidoubiwa
Copy link

bidoubiwa commented Apr 28, 2020

  • 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
@koibi2
Copy link

koibi2 commented May 12, 2020

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

image

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

---
sidebarDepth: 0
---

## title
blabla......

@janober
Copy link

janober commented Jun 6, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants