Skip to content

Commit

Permalink
Merge pull request #182 from Cryolitia/master
Browse files Browse the repository at this point in the history
fix: `sortMenusByFrontmatterOrder` not been sorted in numerical order but in string order
  • Loading branch information
jooy2 authored Sep 26, 2024
2 parents 853f77a + b0170ba commit c8ced8d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,8 @@ export default class VitePressSidebar {
sidebarItems = VitePressSidebar.sortByObjectKey({
arr: sidebarItems,
key: 'order',
desc: options.sortMenusOrderByDescending
desc: options.sortMenusOrderByDescending,
numerically: true
});

VitePressSidebar.deepDeleteKey(sidebarItems, 'order');
Expand Down
2 changes: 1 addition & 1 deletion test/resources/frontmatter-basic/a.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: A Frontmatter
order: 4
order: 10
date: 2023-01-05
author: cdget.com
exclude: true
Expand Down

0 comments on commit c8ced8d

Please sign in to comment.