File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change 1- import { getPostBySlug } from "@/lib/blog"
1+ import { getPostBySlug , getSortedPosts } from "@/lib/blog"
22import { format } from "date-fns"
33import { notFound } from "next/navigation"
44import Image from "next/image"
@@ -8,15 +8,15 @@ import { Button } from "@/components/ui/button"
88import Markdown from "react-markdown"
99import rehypeHighlight from "rehype-highlight"
1010
11- type BlogPostPageProps = {
12- params : {
13- slug : string
14- }
15- searchParams ?: { [ key : string ] : string | string [ ] | undefined }
11+ export async function generateStaticParams ( ) {
12+ const posts = await getSortedPosts ( )
13+ return posts . map ( ( post ) => ( {
14+ slug : post . slug ,
15+ } ) )
1616}
1717
18- export default async function BlogPostPage ( { params } : BlogPostPageProps ) {
19- const post = await getPostBySlug ( params . slug )
18+ export default async function Page ( { params } : { params : Promise < { slug : string } > } ) {
19+ const post = await getPostBySlug ( ( await params ) . slug )
2020
2121 if ( ! post ) {
2222 notFound ( )
You can’t perform that action at this time.
0 commit comments