Skip to content

Vuepress 2 support #56

@GreenImp

Description

@GreenImp

Is your feature request related to a problem? Please describe.
The sidebar config has changed slightly in Vuepress v2, which means that this library no longer generates a sidebar config that is compatible with Vuepress 2.

The docs for v2 are here: https://v2.vuepress.vuejs.org/reference/default-theme/config.html#sidebar

Firstly, the title property has been changed to text.
Another issue, that doesn't appear to be documented, is that the link strings need to be the full path, rather than just the relative path.

With a structure like:

/code/ - file-a.md - file-b.md sub-directory/ - file-c.md 

The sidebar is currently generated as:

{ '/code/': [ { title: 'Code', children: [['', '' + title + ''], 'file-a', 'file-b'], } { title: 'sub-directory', children: ['sub-directory/file-c'], } ], }

When navigating into the sub-directory, the links to the root directory get changed like sub-directory/file-a, which is broken.
To fix it, it needs to be like this:

{ '/code/': [ { text: 'Code', children: [{link: '/code/', text: '' + title + ''}, '/code/file-a', '/code/file-b'], } { text: 'sub-directory', children: ['/code/sub-directory/file-c'], } ], }

Note above that the root level first link has also been changed to an object - it looks like the array style used before also no longer works.

Describe the solution you'd like
For the library to export the config in a way that is compatible with VuePress v2.

Describe alternatives you've considered
I'm not really sure there are other alternatives 🤷

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions