Skip to content

YAML front matter 的参数 subSidebar: false 设置存疑 #267

@Mu-Yan

Description

@Mu-Yan

vuepress-theme-reco@1.5.7 版本,在 subSidebar: 'auto' 的时候,设置指定页面的 YAML front matter 的 subSidebar: false 时,不生效,经查发现是$showSubSideBar 方法判断问题

$showSubSideBar () {
      const {
        $themeConfig: { subSidebar: themeSubSidebar, sidebar: themeSidebar },
        $frontmatter: { subSidebar: pageSubSidebar, sidebar: pageSidebar }
      } = this

      const headers = this.$page.headers || []

      return [themeSubSidebar, themeSidebar, pageSubSidebar, pageSidebar].indexOf('auto') > -1 &&
             headers.length > 0
    }
// .vuepress/config.js
module.exports = {
  themeConfig: {
    subSidebar: 'auto'//在所有页面中启用自动生成子侧边栏,原 sidebar 仍然兼容
  }
}
---
subSidebar: false
---

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions