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 <h1>blog</h1>
14 {
15 posts.map((post) => (
16 <article>
17 {post.data.image && (
18 <img
19 src={post.data.image}
20 alt={post.data.imageAlt || ""}
21 class="floating-image"
22 style="height: 64px"
23 />
24 )}
25 <h1>
26 <a href={`/blog/${post.slug}`}>{post.data.title}</a>
27 </h1>
28 <BlogMeta
29 pubDate={post.data.pubDate}
30 categories={post.data.categories}
31 />
32 <p>{post.data.description}</p>
33 </article>
34 ))
35 }
36</Layout>