forked from
devins.page/devins.page
my website, hosted on wisp.place
1---
2import { getCollection } from "astro:content";
3import Layout from "../layouts/Layout.astro";
4import BlogMeta from "../components/BlogMeta.astro";
5
6const posts = await getCollection("blog");
7posts.sort(
8 (a, b) => (b.data.pubDate?.valueOf() ?? 0) - (a.data.pubDate?.valueOf() ?? 0),
9);
10---
11
12<Layout title="blog" description="my personal blog">
13 <div class="flex flex-col space-y-6">
14 {
15 posts.map((post) => (
16 <a href={`/blog/${post.slug}`}>
17 <article class="border border-dp-text-light/20 bg-dp-background2-light dark:bg-dp-background-dark p-4 space-y-2 rounded-xs">
18 {post.data.image && (
19 <img
20 src={post.data.image}
21 alt={post.data.imageAlt || ""}
22 class="float-end size-16 rounded-sm"
23 />
24 )}
25 <h1>{post.data.title}</h1>
26 <BlogMeta
27 pubDate={post.data.pubDate}
28 categories={post.data.categories}
29 />
30 <p>{post.data.description}</p>
31 </article>
32 </a>
33 ))
34 }
35 </div>
36</Layout>