@@ -3,9 +3,10 @@ import Link from "next/link";
33import { notFound } from "next/navigation" ;
44import { allPosts } from "contentlayer/generated" ;
55
6- import { BackButton } from "@/components/layout/back-button" ;
7- import { Footer } from "@/components/layout/footer" ;
8- import { Mdx } from "@/components/mdx" ;
6+ import { Mdx } from "@/components/content/mdx" ;
7+ import { formatDate } from "@/lib/utils" ;
8+
9+ export const dynamic = "force-static" ;
910
1011export async function generateStaticParams ( ) {
1112 return allPosts . map ( ( post ) => ( {
@@ -17,7 +18,7 @@ export async function generateMetadata({
1718 params,
1819} : {
1920 params : { slug : string } ;
20- } ) : Promise < Metadata | undefined > {
21+ } ) : Promise < Metadata | void > {
2122 const post = allPosts . find ( ( post ) => post . slug === params . slug ) ;
2223 if ( ! post ) {
2324 return ;
@@ -56,35 +57,23 @@ export default function PostPage({ params }: { params: { slug: string } }) {
5657 if ( ! post ) {
5758 notFound ( ) ;
5859 }
59- return (
60- < >
61- < article className = "relative my-5 grid grid-cols-[1fr,min(90%,100%),1fr] gap-y-8 sm:grid-cols-[1fr,min(90%,100%),1fr] sm:pt-8 md:grid md:grid-cols-[1fr,min(80%,100%),1fr] lg:grid-cols-[1fr,min(70%,100%),1fr] xl:grid-cols-[1fr,minmax(auto,240px),min(50%,100%),minmax(auto,240px),1fr] xl:gap-x-5 xl:px-0 [&>*]:col-start-2 xl:[&>*]:col-start-3" >
62- < div >
63- < BackButton />
64- </ div >
6560
66- < section className = "mt-1" >
67- < div className = "mt-2 w-full sm:pointer-events-none xl:!col-end-5" >
68- < h1 className = "text-3xl font-bold sm:text-4xl" > { post . title } </ h1 >
69- </ div >
70- < div className = "mt-2 flex flex-col items-center justify-between sm:flex-row" >
71- < div >
72- < Link href = { post . authorLink } > { post . author } </ Link >
73- < span className = "text-muted-foreground" >
74- { " / " }
75- { post . publishedAtFormatted }
76- </ span >
77- </ div >
78- < div className = "text-muted-foreground text-sm sm:pointer-events-none lg:text-base" >
79- ~{ post . readingTime }
80- </ div >
81- </ div >
82- </ section >
83-
84- { /* load Post content stored in .mdx format */ }
61+ // TODO: add author.avatar and author.url
62+ return (
63+ < article className = "grid gap-8" >
64+ < div className = "mx-auto grid max-w-prose gap-3" >
65+ < h1 className = "font-cal text-3xl" > { post . title } </ h1 >
66+ < p className = "text-muted-foreground text-sm font-light" >
67+ { post . author . name }
68+ < span className = "text-muted-foreground/70 mx-1" > •</ span >
69+ { formatDate ( new Date ( post . publishedAt ) ) }
70+ < span className = "text-muted-foreground/70 mx-1" > •</ span >
71+ { post . readingTime }
72+ </ p >
73+ </ div >
74+ < div className = "mx-auto max-w-prose" >
8575 < Mdx code = { post . body . code } />
86- </ article >
87- < Footer />
88- </ >
76+ </ div >
77+ </ article >
8978 ) ;
9079}
0 commit comments