docs: support multiple sidebars in a project (#11768)
* changed to new sidebar across projects except resources * finalize multi sidebar support * clean up * remove redundant property * small changes * fixes * generate * fix error * fix initial open
This commit is contained in:
@@ -1,31 +0,0 @@
|
||||
/** @type {Partial<import("@/types").SidebarItem[]>} */
|
||||
const commonOptions = {
|
||||
loaded: true,
|
||||
isPathHref: true,
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {import("@/types").SidebarItem[]} sidebar
|
||||
* @param {boolean} nested
|
||||
* @returns {import("@/types").SidebarItem[]}
|
||||
*/
|
||||
export function sidebarAttachHrefCommonOptions(sidebar, nested = false) {
|
||||
return sidebar.map((item) => {
|
||||
if (item.type === "separator") {
|
||||
return item
|
||||
}
|
||||
|
||||
const updatedItem = {
|
||||
...commonOptions,
|
||||
...item,
|
||||
children: sidebarAttachHrefCommonOptions(item.children || [], true),
|
||||
}
|
||||
|
||||
if (updatedItem.type !== "category" && !nested) {
|
||||
updatedItem.childrenSameLevel = true
|
||||
}
|
||||
|
||||
return updatedItem
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user