File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -3,12 +3,21 @@ import Footer from "@/components/footer";
33import { posts } from "@/app/blog/posts" ;
44import Link from "next/link" ;
55
6- interface BlogPageProps {
7- params : { slug : string } ;
6+ export async function generateStaticParams ( ) {
7+ return posts . map ( ( post ) => ( {
8+ slug : post . url ,
9+ } ) ) ;
810}
911
10- export default function BlogPage ( { params } : BlogPageProps ) {
11- const post = posts . find ( ( p ) => p . url === params . slug ) ;
12+
13+ export default async function Page ( {
14+ params,
15+ } : {
16+ params : Promise < { slug : string } >
17+ } ) {
18+ const slug = ( await params ) . slug
19+ const post = posts . find ( ( p ) => p . url === slug ) ;
20+
1221 if ( ! post ) {
1322 return < div className = "p-10" >
1423 Post not found. Go back to < Link href = "/blog" > all blog posts</ Link > ?
You can’t perform that action at this time.
0 commit comments