11import Link from "next/link" ;
22
3- import { cn , formatDate } from "@/lib/utils" ;
4- import { siteConfig } from "@/lib/site-config" ;
3+ import { formatDate } from "@/lib/utils" ;
54
65import { getPosts } from "./posts/page" ;
76
87export default async function Home ( ) {
9- const blogPosts = ( await getPosts ( ) ) . map ( ( post ) => post . frontmatter ) ;
8+ const blogPosts = await getPosts ( ) ;
109 // Get the latest post for the featured section
1110 const featuredPost = blogPosts [ 0 ] ;
1211
@@ -17,7 +16,7 @@ export default async function Home() {
1716 < div className = "min-h-screen bg-white dark:bg-zinc-950" >
1817 < main className = "container mx-auto px-4 py-12" >
1918 { /* Hero Section */ }
20- < section className = "mb-16 border-b border-zinc-200 dark:border-zinc-800 pb-16" >
19+ { /* <section className="mb-16 border-b border-zinc-200 dark:border-zinc-800 pb-16">
2120 <h1 className="mb-6 text-zinc-900 dark:text-zinc-50">{siteConfig.name}</h1>
2221 <p className={cn("text-xl text-muted-foreground", "max-w-3xl mb-8 text-zinc-700 dark:text-zinc-300")}>
2322 {siteConfig.description}
@@ -28,7 +27,7 @@ export default async function Home() {
2827 >
2928 Explorar Ensayos
3029 </Link>
31- </ section >
30+ </section> */ }
3231
3332 { /* Featured Post */ }
3433 < section className = "mb-16" >
@@ -37,15 +36,17 @@ export default async function Home() {
3736 < div className = "lg:col-span-3 space-y-4" >
3837 < div className = "space-y-2" >
3938 < div className = "flex items-center space-x-2" >
40- < time className = "text-sm text-zinc-500 dark:text-zinc-400" > { formatDate ( featuredPost . date ) } </ time >
39+ < time className = "text-sm text-zinc-500 dark:text-zinc-400" >
40+ { formatDate ( featuredPost . frontmatter . date ) }
41+ </ time >
4142 < span className = "text-zinc-300 dark:text-zinc-600" > •</ span >
42- < span className = "text-sm text-zinc-500 dark:text-zinc-400" > { featuredPost . tags [ 0 ] } </ span >
43+ < span className = "text-sm text-zinc-500 dark:text-zinc-400" > { featuredPost . frontmatter . tags [ 0 ] } </ span >
4344 </ div >
4445 < h3 className = "text-zinc-900 dark:text-zinc-50" >
45- < Link href = { `/posts/${ featuredPost . slug } ` } > { featuredPost . title } </ Link >
46+ < Link href = { `/posts/${ featuredPost . slug } ` } > { featuredPost . frontmatter . title } </ Link >
4647 </ h3 >
4748 </ div >
48- < p className = "text-zinc-700 dark:text-zinc-300" > { featuredPost . description } </ p >
49+ < p className = "text-zinc-700 dark:text-zinc-300" > { featuredPost . frontmatter . description } </ p >
4950 < div >
5051 < Link
5152 href = { `/posts/${ featuredPost . slug } ` }
@@ -67,7 +68,7 @@ export default async function Home() {
6768 < div className = "lg:col-span-2 bg-zinc-100 dark:bg-zinc-900 rounded-lg p-6" >
6869 < h4 className = "font-mono font-semibold mb-3 text-zinc-900 dark:text-zinc-50" > Temas Relacionados</ h4 >
6970 < div className = "flex flex-wrap gap-2" >
70- { featuredPost . tags . map ( ( tag ) => (
71+ { featuredPost . frontmatter . tags . map ( ( tag ) => (
7172 < span
7273 key = { tag }
7374 className = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-zinc-200 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-200"
@@ -79,7 +80,7 @@ export default async function Home() {
7980 < div className = "mt-6 pt-6 border-t border-zinc-200 dark:border-zinc-800" >
8081 < h4 className = "font-mono font-semibold mb-3 text-zinc-900 dark:text-zinc-50" > Extracto</ h4 >
8182 < p className = "text-sm text-zinc-700 dark:text-zinc-300 line-clamp-6" >
82- { /* { featuredPost.content. split("\n").slice(0, 3).join(" ").substring(0, 300)}... */ }
83+ { featuredPost . frontmatter . description . split ( "\n" ) . slice ( 0 , 3 ) . join ( " " ) . substring ( 0 , 300 ) } ...
8384 </ p >
8485 </ div >
8586 </ div >
@@ -92,35 +93,37 @@ export default async function Home() {
9293 < div className = "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8" >
9394 { recentPosts . map ( ( post ) => (
9495 < article
95- key = { post . title }
96+ key = { post . frontmatter . title }
9697 className = "border border-zinc-200 dark:border-zinc-800 rounded-lg overflow-hidden flex flex-col"
9798 >
9899 < div className = "p-6 flex-1" >
99100 < div className = "flex items-center space-x-2 mb-3" >
100- < time className = "text-sm text-zinc-500 dark:text-zinc-400" > { formatDate ( post . date ) } </ time >
101+ < time className = "text-sm text-zinc-500 dark:text-zinc-400" >
102+ { formatDate ( post . frontmatter . date ) }
103+ </ time >
101104 < span className = "text-zinc-300 dark:text-zinc-600" > •</ span >
102- < span className = "text-sm text-zinc-500 dark:text-zinc-400" > { post . tags [ 0 ] } </ span >
105+ < span className = "text-sm text-zinc-500 dark:text-zinc-400" > { post . frontmatter . tags [ 0 ] } </ span >
103106 </ div >
104107 < h3 className = "mb-2 text-zinc-900 dark:text-zinc-50" >
105- < Link href = { `/posts/${ post . slug || slugify ( post . title ) } ` } className = "hover:underline" >
106- { post . title }
108+ < Link href = { `/posts/${ post . slug } ` } className = "hover:underline" >
109+ { post . frontmatter . title }
107110 </ Link >
108111 </ h3 >
109- < p className = "mb-4 line-clamp-3 text-zinc-700 dark:text-zinc-300" > { post . description } </ p >
112+ < p className = "mb-4 line-clamp-3 text-zinc-700 dark:text-zinc-300" > { post . frontmatter . description } </ p >
110113 </ div >
111114 < div className = "px-6 py-4 bg-zinc-50 dark:bg-zinc-900 border-t border-zinc-200 dark:border-zinc-800" >
112115 < div className = "flex flex-wrap gap-2" >
113- { post . tags . slice ( 0 , 3 ) . map ( ( tag ) => (
116+ { post . frontmatter . tags . slice ( 0 , 3 ) . map ( ( tag ) => (
114117 < span
115118 key = { tag }
116119 className = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-zinc-200 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-200"
117120 >
118121 { tag }
119122 </ span >
120123 ) ) }
121- { post . tags . length > 3 && (
124+ { post . frontmatter . tags . length > 3 && (
122125 < span className = "inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-zinc-200 text-zinc-800 dark:bg-zinc-800 dark:text-zinc-200" >
123- +{ post . tags . length - 3 }
126+ +{ post . frontmatter . tags . length - 3 }
124127 </ span >
125128 ) }
126129 </ div >
@@ -141,12 +144,3 @@ export default async function Home() {
141144 </ div >
142145 ) ;
143146}
144-
145- // Helper function to create URL-friendly slugs
146- function slugify ( text : string ) : string {
147- return text
148- . toLowerCase ( )
149- . replace ( / [ ^ \w \s - ] / g, "" )
150- . replace ( / [ \s _ - ] + / g, "-" )
151- . replace ( / ^ - + | - + $ / g, "" ) ;
152- }
0 commit comments