Skip to content

Commit 8d574a5

Browse files
committed
feat: added writing page
1 parent 7febe6d commit 8d574a5

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

src/pages/writing/index.astro

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
import { getCollection, getEntry, render } from 'astro:content';
3+
import Author from '@/components/ui/Author.astro';
4+
import Container from '@/components/Container.astro';
5+
import BaseLayout from '@/layouts/BaseLayout.astro';
6+
import { DEFAULT_CONFIGURATION } from '@/lib/constants';
7+
import PostPreview from '@/components/ui/PostPreview.astro';
8+
9+
const entry = await getEntry('pages', 'posts');
10+
11+
if (!entry) {
12+
throw new Error('Posts content not found in src/content/pages');
13+
}
14+
const posts = await getCollection('posts');
15+
---
16+
17+
<BaseLayout>
18+
<section class="py-6">
19+
<Container>
20+
<Author {...DEFAULT_CONFIGURATION.author} />
21+
</Container>
22+
</section>
23+
<section class="py-6">
24+
<Container>
25+
<div class="flex flex-col gap-6">
26+
<span class="text-headings">Latest posts</span>
27+
<ul class="flex flex-col gap-3">
28+
{posts.map((post) => <PostPreview entry={post} />)}
29+
</ul>
30+
</div>
31+
</Container>
32+
</section>
33+
</BaseLayout>

0 commit comments

Comments
 (0)