jooy2 / vitepress-sidebar

🔌 VitePress Sidebar is a plugin for VitePress that automatically configures and manages the sidebar of your page with simple settings.

Home Page:https://vitepress-sidebar.jooy2.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request] use numeric prefix for ordering (like nuxt/content)

mukundshah opened this issue · comments

To sort the item in custom order, front matter order is being required

This can be replaced with a numeric prefix instead, like the way Nuxt Content handles it.

commented

Hello, thank you for using vitepress-sidebar!

In the recently updated version (1.20.0), i added a new option of sortMenusOrderNumericallyFromTitle (Ref).
This option supports ascending/descending sorting based on the first number in the document title or file title.

Can you confirm that your request meets the requirements of this feature?
If not, please leave a more detailed description so we can improve it.

Regrads,

It did but only the half of it;

For example, 1.title-foo-bar.md should resolve to 'Title foo bar'. And link should also be /title -foo-bar, eliminating the number from link and title.

When I looked into VitePress, for links, only way to achieve this was by remapping URLs, as there is no way to alter how URLs are constructed. I'm still looking into it.

commented

Hi, thank you for your detailed problem description.

I have released a new version 1.21.0 today. I added removePrefixAfterOrdering and prefixSeparator options.
Setting the value of removePrefixAfterOrdering to true allows you to remove numeric or letter-based prefixes from sidebar items after the sorting is complete.

For more information, see the following description: https://vitepress-sidebar.jooy2.com/options#removeprefixafterordering

Could you please update to that version and see if it resolves the issue for your requirements?
Thanks,

NOTE: Starting with this version, the documentation page has been moved from README.md to https://vitepress-sidebar.jooy2.com

commented

I'm closing the issue since there's no response, please open a new issue if you have any issues.

Regards,