@@ -6,6 +6,16 @@ import { baseOptions } from '@/app/layout.config';
66import Link from 'next/link' ;
77import { ArrowLeft } from 'lucide-react' ;
88
9+ // Extended type for blog post data
10+ interface BlogPostData {
11+ title : string ;
12+ description ?: string ;
13+ author ?: string ;
14+ date ?: string ;
15+ tags ?: string [ ] ;
16+ body : React . ComponentType ;
17+ }
18+
919export default async function BlogPage ( {
1020 params,
1121} : {
@@ -28,52 +38,55 @@ export default async function BlogPage({
2838 </ div >
2939
3040 < div className = "grid gap-8 md:grid-cols-2" >
31- { posts . map ( ( post ) => (
32- < Link
33- key = { post . url }
34- href = { post . url }
35- className = "group block rounded-lg border border-fd-border bg-fd-card p-6 transition-all hover:border-fd-primary/30 hover:shadow-md"
36- >
37- < div className = "mb-3" >
38- < h2 className = "text-2xl font-semibold mb-2 group-hover:text-fd-primary transition-colors" >
39- { post . data . title }
40- </ h2 >
41- { post . data . description && (
42- < p className = "text-fd-foreground/70" >
43- { post . data . description }
44- </ p >
45- ) }
46- </ div >
47-
48- < div className = "flex items-center gap-4 text-sm text-fd-foreground/70" >
49- { post . data . date && (
50- < time dateTime = { post . data . date } >
51- { new Date ( post . data . date ) . toLocaleDateString ( 'en-US' , {
52- year : 'numeric' ,
53- month : 'long' ,
54- day : 'numeric' ,
55- } ) }
56- </ time >
57- ) }
58- { post . data . author && (
59- < span > By { post . data . author } </ span >
60- ) }
61- </ div >
62-
63- { post . data . tags && post . data . tags . length > 0 && (
64- < div className = "mt-4 flex flex-wrap gap-2" >
65- { post . data . tags . map ( ( tag : string ) => (
66- < span
67- key = { tag }
68- className = "inline-flex items-center rounded-full bg-fd-primary/10 px-2.5 py-0.5 text-xs font-medium text-fd-primary"
69- >
70- { tag }
71- </ span >
72- ) ) }
41+ { posts . map ( ( post ) => {
42+ const postData = post . data as unknown as BlogPostData ;
43+ return (
44+ < Link
45+ key = { post . url }
46+ href = { post . url }
47+ className = "group block rounded-lg border border-fd-border bg-fd-card p-6 transition-all hover:border-fd-primary/30 hover:shadow-md"
48+ >
49+ < div className = "mb-3" >
50+ < h2 className = "text-2xl font-semibold mb-2 group-hover:text-fd-primary transition-colors" >
51+ { postData . title }
52+ </ h2 >
53+ { postData . description && (
54+ < p className = "text-fd-foreground/70" >
55+ { postData . description }
56+ </ p >
57+ ) }
58+ </ div >
59+
60+ < div className = "flex items-center gap-4 text-sm text-fd-foreground/70" >
61+ { postData . date && (
62+ < time dateTime = { postData . date } >
63+ { new Date ( postData . date ) . toLocaleDateString ( 'en-US' , {
64+ year : 'numeric' ,
65+ month : 'long' ,
66+ day : 'numeric' ,
67+ } ) }
68+ </ time >
69+ ) }
70+ { postData . author && (
71+ < span > By { postData . author } </ span >
72+ ) }
7373 </ div >
74- ) }
75- </ Link >
76- ) ) }
74+
75+ { postData . tags && postData . tags . length > 0 && (
76+ < div className = "mt-4 flex flex-wrap gap-2" >
77+ { postData . tags . map ( ( tag : string ) => (
78+ < span
79+ key = { tag }
80+ className = "inline-flex items-center rounded-full bg-fd-primary/10 px-2.5 py-0.5 text-xs font-medium text-fd-primary"
81+ >
82+ { tag }
83+ </ span >
84+ ) ) }
85+ </ div >
86+ ) }
87+ </ Link >
88+ ) ;
89+ } ) }
7790 </ div >
7891
7992 { posts . length === 0 && (
@@ -93,6 +106,7 @@ export default async function BlogPage({
93106 notFound ( ) ;
94107 }
95108
109+ const pageData = page . data as unknown as BlogPostData ;
96110 const MDX = page . data . body ;
97111
98112 return (
@@ -108,32 +122,32 @@ export default async function BlogPage({
108122
109123 < article className = "prose prose-neutral dark:prose-invert max-w-none" >
110124 < header className = "mb-8 pb-8 border-b border-fd-border" >
111- < h1 className = "text-4xl font-bold mb-4" > { page . data . title } </ h1 >
125+ < h1 className = "text-4xl font-bold mb-4" > { pageData . title } </ h1 >
112126
113- { page . data . description && (
127+ { pageData . description && (
114128 < p className = "text-xl text-fd-foreground/80 mb-6" >
115- { page . data . description }
129+ { pageData . description }
116130 </ p >
117131 ) }
118132
119133 < div className = "flex items-center gap-4 text-sm text-fd-foreground/70" >
120- { page . data . date && (
121- < time dateTime = { page . data . date } >
122- { new Date ( page . data . date ) . toLocaleDateString ( 'en-US' , {
134+ { pageData . date && (
135+ < time dateTime = { pageData . date } >
136+ { new Date ( pageData . date ) . toLocaleDateString ( 'en-US' , {
123137 year : 'numeric' ,
124138 month : 'long' ,
125139 day : 'numeric' ,
126140 } ) }
127141 </ time >
128142 ) }
129- { page . data . author && (
130- < span > By { page . data . author } </ span >
143+ { pageData . author && (
144+ < span > By { pageData . author } </ span >
131145 ) }
132146 </ div >
133147
134- { page . data . tags && page . data . tags . length > 0 && (
148+ { pageData . tags && pageData . tags . length > 0 && (
135149 < div className = "mt-4 flex flex-wrap gap-2" >
136- { page . data . tags . map ( ( tag : string ) => (
150+ { pageData . tags . map ( ( tag : string ) => (
137151 < span
138152 key = { tag }
139153 className = "inline-flex items-center rounded-full bg-fd-primary/10 px-3 py-1 text-sm font-medium text-fd-primary"
0 commit comments