11import Link from "next/link" ;
2- import { getAllPosts } from "@/lib/content" ;
2+ import { getAllPosts , getBlogPosts } from "@/lib/content" ;
33import { CoverImage } from "@/components/ResponsiveImage" ;
44
55export 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