Closed as duplicate of#4114
Closed as duplicate of#4114
Description
Is your feature request related to a problem? Please describe.
Sidebar
define in code:
export type Sidebar = SidebarItem[] | SidebarMulti;
export interface SidebarMulti {
[path: string]: SidebarItem[] | { items: SidebarItem[]; base: string };
}
export type SidebarItem = {
text?: string;
link?: string;
items?: SidebarItem[];
collapsed?: boolean;
base?: string;
docFooterText?: string;
rel?: string;
target?: string;
};
This is a direcotry structure:
└── misc
├── cap1.md
├── cap2
│ ├── cap2-1.md
│ └── index.md
├── index.md
└── intro.md
I config sidebar
in config.mts
:
sidebar: {
'/misc': {
base: '/misc',
items: [
{ text: 'Intro', link: '/intro' },
{ text: 'Cap1', link: '/cap1' },
{
text: 'Cap2',
base: '/cap2',
items: [{ text: 'Cap2.1', link: '/cap2-1' }],
},
],
},
}
Actual routes:
/misc/intro.html
/misc/cap1.html
/cap2/cap2-1.html
Describe the solution you'd like
In this setup, it looks like SidebarItem.base
completely replaces the SidebarMulti.base
, instead of working relative to it — which feels a bit unexpected.
Would it be possible for VitePress to support making nested base values inherit from the parent?
Something like this:
/misc/intro.html
/misc/cap1.html
/misc/cap2/cap2-1.html
That’d make things way more intuitive, especially when building out deeper folder structures.
Describe alternatives you've considered
No response
Additional context
Vitepress version: 2.0.0-alpha.7
Here is a minimal reproduction: https://stackblitz.com/edit/vite-yrm66kkm?file=docs%2F.vitepress%2Fconfig.ts
Validations
- Follow our Code of Conduct
- Read the docs.
- Read the Contributing Guidelines.
- Check that there isn't already an issue that asks for the same feature to avoid creating a duplicate.
Metadata
Metadata
Assignees
Labels
No labels