aboutsummaryrefslogtreecommitdiff
path: root/src/pages/index.astro
blob: 56ccdff3d1e59b8f03fa3b762d259e7ab0d2c2c0 (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>