Workaround for the sidebar config using _meta.json
when folders and files are prefixed with numbers
#1718
-
Hi, a few days ago Rspress used to try to read directories as files if they were prefix with digits and dot like Now I'm facing the fact that when directories and/or files are prefixed with digits and dots (for versioning convention) I need to explicitly set the filename in the My team isn't willing to migrate to Rspress unless they need the least effort to make when updating the digits on each markdown changed. Any workaround you would have in mind? A kind of regex or anything? Thank you very much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
you can use glob, and set https://rspress.dev/api/config/config-theme#sidebar manually and programmatically import { defineConfig } from 'rspress/config';
import glob from 'fast-glob';
const files = glob.sync('./docs/foo/**/*.{md,mdx}');
const sidebars = files.map(() => {
return [...]
})
export default defineConfig({
themeConfig: {
sidebar: {
'/guide/': [
{
text: 'Getting Started',
items: [
// Fill in an object
{
text: 'Introduction',
link: '/guide/getting-started/introduction',
},
{
text: 'Installation',
link: '/guide/getting-started/installation',
},
...sidebars
],
},
],
},
},
}); |
Beta Was this translation helpful? Give feedback.
you can use glob, and set https://rspress.dev/api/config/config-theme#sidebar manually and programmatically