From 10c6307d390ab6bf3f8f9daf3e20235d2b3d02c6 Mon Sep 17 00:00:00 2001 From: Yelsin Sepulveda Date: Tue, 20 Jan 2026 08:42:49 -0500 Subject: [PATCH] fix[collections]: sorted list for projects & blogs Signed-off-by: Yelsin Sepulveda --- src/pages/Projects.astro | 4 +++- src/pages/index.astro | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pages/Projects.astro b/src/pages/Projects.astro index bc99916..53929ab 100644 --- a/src/pages/Projects.astro +++ b/src/pages/Projects.astro @@ -18,7 +18,9 @@ const projects = await getCollection('project'); Yorisoft::things(); {'};'} - {projects.reverse().map((project) => { + {projects + .toSorted((a, b) => b.data.date - a.data.date) + .map((project) => { const pubDate = project.data.date .toISOString() .split("T")[0]; diff --git a/src/pages/index.astro b/src/pages/index.astro index 9b0b0db..374df81 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -19,10 +19,12 @@ const posts = await getCollection('blog'); Yorisoft::things(); {'};'} - {posts.reverse().map((post) => { + {posts + .toSorted((a, b) => b.data.date - a.data.date) + .map((post) => { const pubDate = post.data.date - .toISOString() - .split("T")[0]; + .toISOString() + .split("T")[0]; return (