From f665396d558fca3e53513000270f13a5341c9d81 Mon Sep 17 00:00:00 2001 From: Devon Campbell Date: Fri, 22 Nov 2024 12:32:44 -0500 Subject: [PATCH] Sort channel names I thought the channel names were already sorted in the source data file, but it turns out they aren't. I now sort them after sorting the category names. --- src/_data/freetubeCategories.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/_data/freetubeCategories.js b/src/_data/freetubeCategories.js index a6a95d1..3fe5ac4 100644 --- a/src/_data/freetubeCategories.js +++ b/src/_data/freetubeCategories.js @@ -108,10 +108,15 @@ module.exports = async function getSubscriptions() { ) }; - // Categories are sorted alphabetically. Subscriptions are already alphabetized in the incoming data. + // Categories are sorted alphabetically. const sortedCategories = categories.sort((a, b) => a.name.localeCompare(b.name)); sortedCategories.push(othersCategory); + // Subscriptions are sorted alphabetically. + sortedCategories.forEach(category => { + category.subscriptions.sort((a, b) => a.name.localeCompare(b.name)); + }); + sortedCategories.forEach(category => { category.subscriptions?.forEach(channel => channel.tags = subscriptionTags[channel.id]) });