Skip to content

Commit aaa3b06

Browse files
committed
feat(3.3): Add a dedicated Blog section
1 parent 706cc9d commit aaa3b06

3 files changed

Lines changed: 28 additions & 0 deletions

File tree

src/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ export const NAV_ITEMS: NavItems = {
55
path: '/',
66
title: 'home'
77
},
8+
blog: {
9+
path: '/blog',
10+
title: 'blog'
11+
},
812
about: {
913
path: '/about',
1014
title: 'about'

src/pages/blog.astro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
import DefaultPageLayout from '$/layouts/default.astro'
3+
import PostPreviewList from '$/components/PostPreviewList.astro'
4+
5+
let title = 'Blog';
6+
let description = 'All the articles posted so far...'
7+
8+
const posts = Astro.fetchContent('./blog/*.md')
9+
---
10+
<DefaultPageLayout content={{ title, description }}>
11+
<PostPreviewList posts={posts} />
12+
</DefaultPageLayout>

src/pages/index.astro

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,16 @@ const posts = Astro.fetchContent('./blog/*.md')
1010
---
1111
<DefaultPageLayout content={{ title, description }} showPageHeader={false}>
1212
<PostPreviewList posts={posts} />
13+
<div class="page__actions">
14+
<a class="action__go-to-blog" href="/blog" title="All Posts">All Posts &rarr;</a>
15+
</div>
1316
</DefaultPageLayout>
17+
18+
<style>
19+
.page__actions {
20+
@apply flex justify-center md:justify-end py-6
21+
}
22+
.action__go-to-blog {
23+
@apply text-base uppercase text-gray-400 dark:text-gray-600 hover:underline
24+
}
25+
</style>

0 commit comments

Comments
 (0)