diff --git a/apps/blog/src/pages/index.astro b/apps/blog/src/pages/index.astro index 845308e..1c7a0a1 100644 --- a/apps/blog/src/pages/index.astro +++ b/apps/blog/src/pages/index.astro @@ -28,8 +28,12 @@ const grouped = posts.reduce((acc, post) => { return acc; }, {} as Record); -// Sort categories alphabetically -const sortedCategories = Object.keys(grouped).sort(); +// Sort categories: "posts" first, then alphabetically +const sortedCategories = Object.keys(grouped).sort((a, b) => { + if (a === 'posts') return -1; + if (b === 'posts') return 1; + return a.localeCompare(b); +}); // Sort posts within each category: pinned first, then by date descending for (const category of sortedCategories) { diff --git a/apps/blog/src/pages/md/index.astro b/apps/blog/src/pages/md/index.astro index e3d7ad0..f918c9d 100644 --- a/apps/blog/src/pages/md/index.astro +++ b/apps/blog/src/pages/md/index.astro @@ -12,8 +12,12 @@ const grouped = posts.reduce((acc, post) => { return acc; }, {} as Record); -// Sort categories alphabetically -const sortedCategories = Object.keys(grouped).sort(); +// Sort categories: "posts" first, then alphabetically +const sortedCategories = Object.keys(grouped).sort((a, b) => { + if (a === 'posts') return -1; + if (b === 'posts') return 1; + return a.localeCompare(b); +}); // Sort posts within each category: pinned first, then by date descending for (const category of sortedCategories) {