Skip to content

Workaround for the sidebar config using _meta.json when folders and files are prefixed with numbers #1718

Closed Answered by SoonIter
XavierLeTohic asked this question in Q&A
Discussion options

You must be logged in to vote

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/installa…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@XavierLeTohic
Comment options

Answer selected by XavierLeTohic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants