From 5d53cf91ebc08f236916ee178d16247d5413e379 Mon Sep 17 00:00:00 2001 From: Alireza Hassani Date: Sat, 22 Aug 2026 23:56:15 +0330 Subject: [PATCH] Fix blog route conflict that crashed the Next.js server. Rename legacy /blog/[slug] redirect to /blog/[id] so it matches the nested [id]/[slug] segment name. Co-authored-by: Cursor --- app/blog/{[slug] => [id]}/page.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) rename app/blog/{[slug] => [id]}/page.tsx (63%) diff --git a/app/blog/[slug]/page.tsx b/app/blog/[id]/page.tsx similarity index 63% rename from app/blog/[slug]/page.tsx rename to app/blog/[id]/page.tsx index d9b9690..855bba3 100644 --- a/app/blog/[slug]/page.tsx +++ b/app/blog/[id]/page.tsx @@ -4,18 +4,18 @@ import { getBlogPost } from "@/lib/data"; export const revalidate = 60; -/** Legacy `/blog/{slug}` → canonical `/blog/{id}/{titleSlug}`. */ +/** Legacy `/blog/{slug-or-id}` → canonical `/blog/{id}/{titleSlug}`. */ export default async function LegacyBlogRedirect({ params, }: { - params: Promise<{ slug: string }>; + params: Promise<{ id: string }>; }) { - const { slug } = await params; + const { id } = await params; - const apiPost = await fetchBlogBySlug(slug); + const apiPost = await fetchBlogBySlug(id); if (apiPost) redirect(blogHref(apiPost)); - const local = getBlogPost(slug); + const local = getBlogPost(id); if (local) redirect(blogHref({ id: local.slug, title: local.title })); notFound();