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";
3
3
import { posts } from "@/app/blog/posts" ;
4
4
import Link from "next/link" ;
5
5
6
- interface BlogPageProps {
7
- params : { slug : string } ;
6
+ export async function generateStaticParams ( ) {
7
+ return posts . map ( ( post ) => ( {
8
+ slug : post . url ,
9
+ } ) ) ;
8
10
}
9
11
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
+
12
21
if ( ! post ) {
13
22
return < div className = "p-10" >
14
23
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