blob: 5e4c61928af679e213f94ecabb2016f4f388e4a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
---
import Page from "../../layouts/Page.astro";
import { getCollection } from "astro:content";
import {formatDate} from "../../util";
import "../../styles/cards.css";
const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf());
---
<Page title="Blog" description="Where I post can be anything!">
<main>
<div class="grid">
{allBlogPosts.map((post) => (
<article class="card">
<h1><a href={`/blog/${post.slug}`}>{post.data.title}</a></h1>
<small>{formatDate(post.data.pubDate)}</small>
<p>{post.data.description}</p>
<div class="tags">
{post.data.tags.map((tag) => (
<a href={`/blog/tags/${tag}`}>{tag}</a>
))}
</div>
</article>
))
}
</div>
</main>
</Page>
<style>
.tags {
display: flex;
flex-direction: row;
gap: 1em;
}
</style>
|