-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: Excluded routes still appear in the no-config sidebars #848
Comments
I found a way to exclude the excluded route from the no-config sidebar. I can work on a pull request if necessary but since I'm not sure that it is considered a bug or a feature that could be added to pluginAutoNavSidebar I will write my code here: I replaced the following code:
with one of those: // can ignore assets/**/* because it doesn't direcly match directories, it only matches files and route.exclude is supposed to target files
const includedFiles = globby.sync(`**`, { cwd: workDir, ignore: [...exclude] });
const subItems = Array.from(new Set(includedFiles.map((file) => file.split("/")[0]))); // can only ignore assets/** because it only matches direct children
const subItems = globby.sync(`*`, { cwd: workDir, onlyFiles: false, ignore: [...exclude] });
Side note |
Yes, you are right. When fallback to readdir, we need add exclude. Welcome PR |
Reply to your side note: |
…exclude files from auto-generated sidebar
…ion, fixed globby import, fixed empty folder appearing in sidebars, fixed changeset
Version
System: OS: Windows 10 10.0.19045 CPU: (8) x64 Intel(R) Core(TM) i5-10310U CPU @ 1.70GHz Memory: 2.99 GB / 15.69 GB Browsers: Chrome: 121.0.6167.185 Edge: Chromium (122.0.2365.92) Internet Explorer: 11.0.19041.3636 npmPackages: rspress: ^1.0.0 => 1.15.1
Details
I added the following lines to the rspress.config.ts :
expecting all assets in /docs and the 4-ignore.md not to have routes created for them and not appear in sidebars.
The routes are indeed not created but they still appear in the sidebar:
I don't really know if this is a bug but I would say that no-config sidebars should not display non-existing pages.
Reproduce link
https://codesandbox.io/p/devbox/minimal-route-exclude-in-sidebar-reproduction-gwzr65?file=%2Frspress.config.ts
Reproduce Steps
_meta.json
in docs/guide4-ignore.md
The text was updated successfully, but these errors were encountered: