aboutsummaryrefslogtreecommitdiff
path: root/src/pages/blog/index.astro
blob: 210a7a18ce15c956bad4d64e04991068d0755f60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
---
import { getCollection } from "astro:content";
import Layout from "../../layouts/BaseLayout.astro";
import PostSummary from "../../components/PostSummary.astro";

const posts = await getCollection("blog", ({ data }) => {
	return data.draft !== true;
});

posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime());
---

<Layout>
	<section style={{ "margin-top": "3rem" }}>
		{posts.map((post) => <PostSummary post={post} />)}
	</section>
</Layout>