Upgrade to Next.js 16 with Turbopack and Contentlayer2
- Upgraded Next.js to v16, React to v19 - Migrated from contentlayer to contentlayer2 - Migrated to Turbopack by decoupling Contentlayer from webpack - Updated all page components to handle async params (Next.js 15+ breaking change) - Changed package.json to type: module and renamed config files to .cjs - Updated README with current tech stack and article creation instructions - Fixed tag encoding issue (removed double encoding) - All security vulnerabilities resolved (npm audit: 0 vulnerabilities)
This commit is contained in:
@@ -20,11 +20,11 @@ export function generateStaticParams() {
|
||||
}
|
||||
|
||||
interface Props {
|
||||
params: { slug: string };
|
||||
params: Promise<{ slug: string }>;
|
||||
}
|
||||
|
||||
export function generateMetadata({ params }: Props): Metadata {
|
||||
const slug = params.slug;
|
||||
export async function generateMetadata({ params }: Props): Promise<Metadata> {
|
||||
const { slug } = await params;
|
||||
const post = getPostBySlug(slug);
|
||||
if (!post) return {};
|
||||
|
||||
@@ -34,8 +34,8 @@ export function generateMetadata({ params }: Props): Metadata {
|
||||
};
|
||||
}
|
||||
|
||||
export default function BlogPostPage({ params }: Props) {
|
||||
const slug = params.slug;
|
||||
export default async function BlogPostPage({ params }: Props) {
|
||||
const { slug } = await params;
|
||||
const post = getPostBySlug(slug);
|
||||
|
||||
if (!post) return notFound();
|
||||
|
||||
Reference in New Issue
Block a user