Skip to content

Commit 4404e39

Browse files
committed
resolve build errors
1 parent 8073ec7 commit 4404e39

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/app/blog/[slug]/page.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@ import Footer from "@/components/footer";
33
import { posts } from "@/app/blog/posts";
44
import 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>?

0 commit comments

Comments
 (0)