Skip to content

Commit 44f7a7a

Browse files
authored
Merge pull request #58 from micahwalter/claude/add-recent-posts-list-QojVG
2 parents 07ee2d2 + 1c3252e commit 44f7a7a

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

app/page.tsx

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import Link from "next/link";
2-
import { getAllPosts } from "@/lib/content";
2+
import { getAllPosts, getBlogPosts } from "@/lib/content";
33
import { CoverImage } from "@/components/ResponsiveImage";
44

55
export default function Home() {
66
const posts = getAllPosts();
77
const post = posts.find((p) => p.id === "126");
88

9+
const recentPosts = getBlogPosts().slice(0, 5);
10+
911
if (!post || !post.coverImage) return null;
1012

1113
const coverFilename = post.coverImage
@@ -25,9 +27,43 @@ export default function Home() {
2527
viewportFit={true}
2628
/>
2729
</Link>
28-
<p className="mt-4 text-center text-charcoal">
29-
Please enjoy this snowy photo while the site undergoes some maintenance.
30-
</p>
30+
{recentPosts.length > 0 && (
31+
<section className="mt-16 max-w-reading mx-auto">
32+
<h2 className="font-serif font-semibold text-2xl text-charcoal mb-6">
33+
Recent Posts
34+
</h2>
35+
<ul className="space-y-4">
36+
{recentPosts.map((p) => (
37+
<li key={p.slug} className="border-b border-gray/20 pb-4">
38+
<Link
39+
href={`/posts/${p.slug}`}
40+
className="group no-underline"
41+
>
42+
<span className="font-serif text-lg text-charcoal group-hover:text-accent transition-colors">
43+
{p.title}
44+
</span>
45+
<span className="block text-sm text-gray mt-1">
46+
{new Date(p.publishedAt).toLocaleDateString("en-US", {
47+
year: "numeric",
48+
month: "long",
49+
day: "numeric",
50+
timeZone: "UTC",
51+
})}
52+
</span>
53+
</Link>
54+
</li>
55+
))}
56+
</ul>
57+
<div className="mt-8">
58+
<Link
59+
href="/posts"
60+
className="font-serif text-charcoal hover:text-accent transition-colors no-underline"
61+
>
62+
View all posts →
63+
</Link>
64+
</div>
65+
</section>
66+
)}
3167
</main>
3268
);
3369
}

0 commit comments

Comments
 (0)