From eb7920efa3dd6889fe30249de1f0f0f121f1715f Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Fri, 19 Dec 2025 15:00:28 +0100 Subject: Refactor post pagination to sort posts before extracting unique tags --- src/pages/posts/[...page].astro | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/pages') diff --git a/src/pages/posts/[...page].astro b/src/pages/posts/[...page].astro index e07bc29..acca040 100644 --- a/src/pages/posts/[...page].astro +++ b/src/pages/posts/[...page].astro @@ -12,8 +12,9 @@ export const getStaticPaths = (async ({ paginate }) => { const MAX_POSTS_PER_PAGE = 10; const MAX_TAGS = 7; const allPosts = await getAllPosts(); - const uniqueTags = getUniqueTags(allPosts).slice(0, MAX_TAGS); - return paginate(allPosts.sort(collectionDateSort), { + const sortedPosts = allPosts.sort(collectionDateSort); + const uniqueTags = getUniqueTags(sortedPosts).slice(0, MAX_TAGS); + return paginate(sortedPosts, { pageSize: MAX_POSTS_PER_PAGE, props: { uniqueTags }, }); -- cgit v1.2.3