We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent eed553b commit faa65f6Copy full SHA for faa65f6
1 file changed
src/pages/index.astro
@@ -3,7 +3,9 @@ import PostList from '@/components/PostList';
3
import BaseLayout from '@/layouts/BaseLayout.astro';
4
import { getCollection } from 'astro:content';
5
6
-const allPosts = await getCollection('posts');
+const allPosts = (await getCollection('posts')).sort(
7
+ (a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime(),
8
+);
9
---
10
11
<BaseLayout pageTitle="Home">
0 commit comments