Sidebar Category Base Path?
closed
Nicholas Ochoa
It doesn't seem to be possible to specify a "base path" for items listed under a category. This results in a lot of duplication of paths when sidebar categories are nested more than 1 layer deep.
Is it possible to add a 'basePath' property to the SidebarItemCategory type that would prefix any items sidebar items listed?
Current
sidebars.js
SidebarItemCategory:{
type: 'category',
label: 'Testing',
items: [
'apps/testing/trace-logs',
'apps/testing/trace-sql',
]
},
Proposed SidebarItemCategory:
{
type: 'category',
label: 'Testing',
basePath: 'apps/testing/'
items: [
'trace-logs',
'trace-sql',
]
},
This would make managing the
sidebar.js
much easier when there are a lot of entries with nested paths.Joshua Chen
closed
Joshua Chen
This is actually not an easy thing to do. We are also considering the possibility of letting you specify the entire doc ID instead of always prefixing it with the folder path. In this case, the doc ID can be completely detached from the file path. What's written in sidebars.js is the doc ID, not the file path. We don't want an API that confuses users into misconceiving that sidebars.js contains file paths, even if that understanding works most of the time.
However, you can still do
items: [
'trace-logs',
'trace-sql',
].map(item =>
apps/testing/${item}
)Sébastien Lorber
planned