feat: add support for setting sidebarDepth in themeConfig

pull/495/head
Divyansh Singh 4 years ago
parent 4109acf67e
commit ee1d960412

@ -15,7 +15,10 @@ export const SideBarLink: FunctionalComponent<{
const route = useRoute()
const { site, frontmatter } = useData()
const depth = props.depth || 1
const maxDepth = frontmatter.value.sidebarDepth || Infinity
const maxDepth =
frontmatter.value.sidebarDepth ||
site.value.themeConfig.sidebarDepth ||
Infinity
const headers = route.data.headers
const text = props.item.text

@ -15,7 +15,8 @@ export function useSideBar() {
// at first, we'll check if we can find the sidebar setting in frontmatter.
const headers = route.data.headers
const frontSidebar = route.data.frontmatter.sidebar
const sidebarDepth = route.data.frontmatter.sidebarDepth
const sidebarDepth =
route.data.frontmatter.sidebarDepth || site.value.themeConfig.sidebarDepth
// if it's `false`, we'll just return an empty array here.
if (frontSidebar === false) {

@ -3,6 +3,7 @@ export namespace DefaultTheme {
logo?: string
nav?: NavItem[] | false
sidebar?: SideBarConfig | MultiSideBarConfig
sidebarDepth?: number
/**
* GitHub repository following the format <user>/<project>.

Loading…
Cancel
Save