From 871173e4db842baa14fe2ca9e3c259af25a9b282 Mon Sep 17 00:00:00 2001 From: Dan Matthew <111794+danielmatthew@users.noreply.github.com> Date: Sun, 18 Oct 2026 22:11:50 +0100 Subject: [PATCH] fix: correct pagination sorting --- src/pages/articles/[...slug].astro | 4 ++-- src/pages/notes/[...slug].astro | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/articles/[...slug].astro b/src/pages/articles/[...slug].astro index be8f35d..79a673d 100644 --- a/src/pages/articles/[...slug].astro +++ b/src/pages/articles/[...slug].astro @@ -11,9 +11,9 @@ interface Props { } export async function getStaticPaths() { - const articles = await getCollection("articles", ({data}) => { + const articles = (await getCollection("articles", ({ data }) => { return data.published !== false; - }); + })).sort((a, b) => b.data.publishedDate?.valueOf() - a.data.publishedDate?.valueOf()); const numberOfPosts = articles.length; diff --git a/src/pages/notes/[...slug].astro b/src/pages/notes/[...slug].astro index 602fa6d..cc13d00 100644 --- a/src/pages/notes/[...slug].astro +++ b/src/pages/notes/[...slug].astro @@ -18,9 +18,9 @@ interface Props { // } export async function getStaticPaths() { - const notes = await getCollection("posts", ({ data }) => { + const notes = (await getCollection("posts", ({ data }) => { return data.published !== false; - }); + })).sort((a, b) => b.data.publishedDate?.valueOf() - a.data.publishedDate?.valueOf()); const numberOfPosts = notes.length;