Vercel Portfolio Starter Kit MDX support broken
Answered
Transvaal lion posted this in #help-forum
Transvaal lionOP
Anyone have any idea why the portfolio starter kit (https://vercel.com/templates/portfolio/portfolio-starter-kit) on Vercel is broken upon deployment? Dependencies are outdated and MDX blog posts don't work.
Answered by Transvaal lion
Change made in
From:
To:
Made the component async: export default async function Blog
Added proper TypeScript typing: { params: Promise<{ slug: string }> }
Awaited the params: const { slug } = await params
Fixed both functions: Updated both generateMetadata and the main Blog component
app/blog/[slug]/page.tsxFrom:
export default function Blog({ params }) {
let post = getBlogPosts().find((post) => post.slug === params.slug)
// ...
}To:
export default async function Blog({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params
let post = getBlogPosts().find((post) => post.slug === slug)
// ...
}Made the component async: export default async function Blog
Added proper TypeScript typing: { params: Promise<{ slug: string }> }
Awaited the params: const { slug } = await params
Fixed both functions: Updated both generateMetadata and the main Blog component
1 Reply
Transvaal lionOP
Change made in
From:
To:
Made the component async: export default async function Blog
Added proper TypeScript typing: { params: Promise<{ slug: string }> }
Awaited the params: const { slug } = await params
Fixed both functions: Updated both generateMetadata and the main Blog component
app/blog/[slug]/page.tsxFrom:
export default function Blog({ params }) {
let post = getBlogPosts().find((post) => post.slug === params.slug)
// ...
}To:
export default async function Blog({ params }: { params: Promise<{ slug: string }> }) {
const { slug } = await params
let post = getBlogPosts().find((post) => post.slug === slug)
// ...
}Made the component async: export default async function Blog
Added proper TypeScript typing: { params: Promise<{ slug: string }> }
Awaited the params: const { slug } = await params
Fixed both functions: Updated both generateMetadata and the main Blog component
Answer