Open jt196 opened 1 year ago
The above approach sorts by category name irrelevant of count.
To sort by count first and alphabetically within, you can use this:
const sortedUniqueCategories = Object.values(uniqueCategories).sort((a, b) => {
return a.count === b.count ? a.title.localeCompare(b.title) : a.count > b.count;
});
Hey dude, so, been using your template to learn a bit of Sveltekit, thanks for all the work.
You'll notice the blog/category categories isn't correctly alphabetically sorted, here's the code I used to fix it: