29 lines
547 B
Plaintext
29 lines
547 B
Plaintext
---
|
|
import { getCollection } from 'astro:content';
|
|
|
|
import Layout from '@layouts/Layout.astro';
|
|
import PostPreview from '@components/PostPreview.astro';
|
|
|
|
const posts = await getCollection('blog');
|
|
---
|
|
|
|
<Layout title="Blog">
|
|
{
|
|
posts
|
|
.sort(
|
|
(a, b) =>
|
|
new Date(b.data.pubDate).valueOf() -
|
|
new Date(a.data.pubDate).valueOf()
|
|
)
|
|
.slice(0, 10)
|
|
.map((post) => <PostPreview post={post} />)
|
|
}
|
|
{
|
|
posts.length < 6 ? null : (
|
|
<div class="more-posts">
|
|
<a href="/blog/archive/all">All Posts</a>
|
|
</div>
|
|
)
|
|
}
|
|
</Layout>
|