Skip to content

Commit 8a94e86

Browse files
author
Rob Hudson
committed
Fix post sorting on /posts/
1 parent d89fb48 commit 8a94e86

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/pages/posts/[...page].astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { SITE } from "@config";
33
import Posts from "@layouts/Posts.astro";
44
import type { GetStaticPaths } from "astro";
55
import { getCollection } from "astro:content";
6+
import getSortedPosts from "@utils/getSortedPosts";
67
78
export const getStaticPaths = (async ({ paginate }) => {
89
const posts = await getCollection("blog", ({ data }) => !data.draft);
9-
return paginate(posts, { pageSize: SITE.postPerPage });
10+
return paginate(getSortedPosts(posts), { pageSize: SITE.postPerPage });
1011
}) satisfies GetStaticPaths;
1112
1213
const { page } = Astro.props;

src/pages/posts/[page].astro

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import { SITE } from "@config";
33
import Posts from "@layouts/Posts.astro";
44
import type { GetStaticPaths } from "astro";
55
import { getCollection } from "astro:content";
6+
import getSortedPosts from "@utils/getSortedPosts";
67
78
export const getStaticPaths = (async ({ paginate }) => {
89
const posts = await getCollection("blog", ({ data }) => !data.draft);
9-
return paginate(posts, { pageSize: SITE.postPerPage });
10+
return paginate(getSortedPosts(posts), { pageSize: SITE.postPerPage });
1011
}) satisfies GetStaticPaths;
1112
1213
const { page } = Astro.props;

0 commit comments

Comments
 (0)