import { notFound, permanentRedirect } from "next/navigation"; import { getBlog, getBlogById } from "@/lib/api"; import { blogHref } from "@/lib/paths"; /** Legacy `/blog/{slug-or-id}` → canonical `/blog/{id}/{titleSlug}`. */ export default async function LegacyBlogRedirect({ params, }: { params: Promise<{ id: string }>; }) { const { id } = await params; const byId = await getBlogById(id); if (byId) permanentRedirect(blogHref(byId)); const bySlug = await getBlog(id); if (bySlug) permanentRedirect(blogHref(bySlug)); notFound(); }