Open superwushu opened 3 months ago
But the current behavior is the sidebar shows all levels of aaa/bbb/ccc and place the file title to deep bottom, very annoying in looking.
I don't think it is annoying, on the contrary I think this is as expected as we design.
The sidebar generation of Rspress is based on the conventional routing of the file directory. We will perform some automatic detection operations. The middle level bbb
and ccc
should be displayed in the sidebar.
In other words, in the automatic detection scenario, the file directory should truly reflect the level of the sidebar.
In your case, it is recommended to use a custom configuration sidebar array in themeConfig
.
The sidebar generation of Rspress is based on the conventional routing of the file directory. We will perform some automatic detection operations. The middle level
bbb
andccc
should be displayed in the sidebar.In other words, in the automatic detection scenario, the file directory should truly reflect the level of the sidebar.
My understanding is auto detection is based on the existence of _meta.json
. If a directory has no _meta.json
the sidebar info is read from themeConfig
. For intermediate directories that neither have _meta.json
or configured in themeConfig
, they are not supposed to reflect in sidebar.
But if it's designed to be that, I'm okay.
My understanding is auto detection is based on the existence of _meta.json. If a directory has no _meta.json the sidebar info is read from themeConfig.
The designed specific sidebar generation logic is
Use config
When you config themeConfig.sidebar
, all we use is that config, _meta.json
does not take effect.
Auto detection
_meta.json
: use _meta.json
_meta.json
: according to file structure
Version
Details
Auto sidebar works well with typical directory hierarchy in which each level having valid content files and
_meta.json
. But in some cases, we use bare intermediate sub-directory levels for namespace organization in cases of submenu in navbar, e.g.Intermediate directories
bbb
andccc
are bare. The expectation is the sidebar generated foroverview.md
has a flat structure with the file title as the root. But the current behavior is the sidebar shows all levels ofaaa/bbb/ccc
and place the file title to deep bottom, very annoying in looking.A workaround is to use
themeConfig
rather than auto sidebar.But I think a reasonable solution is to skip directory levels without the
_meta.json
file, or introduce a new option to_meta.json
file to skip specified levels. Any thoughts?Reproduce link
see above
Reproduce Steps
see above