From 94ede9bb17e01b9a998e31f388713ce2a94227d6 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Wed, 2 Oct 2024 07:31:12 -0700 Subject: [PATCH] fix: add missing posts sorting (#383) --- src/pages/posts/[...page].astro | 3 ++- src/pages/posts/[page].astro | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pages/posts/[...page].astro b/src/pages/posts/[...page].astro index 0f163e762..b61163949 100644 --- a/src/pages/posts/[...page].astro +++ b/src/pages/posts/[...page].astro @@ -3,10 +3,11 @@ import { SITE } from "@config"; import Posts from "@layouts/Posts.astro"; import type { GetStaticPaths } from "astro"; import { getCollection } from "astro:content"; +import getSortedPosts from "@utils/getSortedPosts"; export const getStaticPaths = (async ({ paginate }) => { const posts = await getCollection("blog", ({ data }) => !data.draft); - return paginate(posts, { pageSize: SITE.postPerPage }); + return paginate(getSortedPosts(posts), { pageSize: SITE.postPerPage }); }) satisfies GetStaticPaths; const { page } = Astro.props; diff --git a/src/pages/posts/[page].astro b/src/pages/posts/[page].astro index 0f163e762..b61163949 100644 --- a/src/pages/posts/[page].astro +++ b/src/pages/posts/[page].astro @@ -3,10 +3,11 @@ import { SITE } from "@config"; import Posts from "@layouts/Posts.astro"; import type { GetStaticPaths } from "astro"; import { getCollection } from "astro:content"; +import getSortedPosts from "@utils/getSortedPosts"; export const getStaticPaths = (async ({ paginate }) => { const posts = await getCollection("blog", ({ data }) => !data.draft); - return paginate(posts, { pageSize: SITE.postPerPage }); + return paginate(getSortedPosts(posts), { pageSize: SITE.postPerPage }); }) satisfies GetStaticPaths; const { page } = Astro.props;