Skip to content

Commit f8be882

Browse files
committed
Added blog archive page
1 parent f81dd52 commit f8be882

File tree

2 files changed

+42
-9
lines changed

2 files changed

+42
-9
lines changed

src/pages/blog/archive.astro

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
import Layout from "@layouts/BaseLayout.astro";
3+
import {getCollection} from "astro:content";
4+
5+
import {fm} from "@helpers/frontmatter";
6+
7+
const allPosts = await getCollection("blogPosts");
8+
9+
export const frontmatter = fm({
10+
title: "Sim's Blog Archive",
11+
description: "Sim's blog.",
12+
keywords: ["blog"],
13+
});
14+
---
15+
16+
<Layout {...frontmatter}>
17+
18+
<h1>Blog Archive</h1>
19+
20+
<p><em>This is an early WIP focused on experimenting with ways to manage my blog posts before migrating <a href="https://blog.simshadows.com/">my old blog</a> to this website.</em></p>
21+
22+
<ul>
23+
{
24+
allPosts.map((post) => (
25+
<li><a href={`/blog/${post.id}/`}>{post.data.title}</a></li>
26+
))
27+
}
28+
</ul>
29+
30+
</Layout>
31+

src/pages/blog/index.astro

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,19 @@ export const frontmatter = fm({
1515

1616
<Layout {...frontmatter}>
1717

18-
<h1>Blog</h1>
18+
<h1>Blog</h1>
1919

20-
<p><em>This is an early WIP focused on experimenting with ways to manage my blog posts before migrating <a href="https://blog.simshadows.com/">my old blog</a> to this website.</em></p>
20+
<p><a href="./archive">Archive</a></p>
2121

22-
<ul>
23-
{
24-
allPosts.map((post) => (
25-
<li><a href={`/blog/${post.id}/`}>{post.data.title}</a></li>
26-
))
27-
}
28-
</ul>
22+
<p><em>This is an early WIP focused on experimenting with ways to manage my blog posts before migrating <a href="https://blog.simshadows.com/">my old blog</a> to this website.</em></p>
23+
24+
<ul>
25+
{
26+
allPosts.map((post) => (
27+
<li><a href={`/blog/${post.id}/`}>{post.data.title}</a></li>
28+
))
29+
}
30+
</ul>
2931

3032
</Layout>
3133

0 commit comments

Comments
 (0)