Clone of clinicsamen.com with Meshkee backend integration for blog, workshops, auth, static image slots, and SEO sitemap config. Co-authored-by: Cursor <cursoragent@cursor.com>
23 lines
559 B
TypeScript
23 lines
559 B
TypeScript
import { notFound, redirect } from "next/navigation";
|
|
|
|
import { blogHref, fetchBlogBySlug, getLocalBlogPost } from "@/lib/blog";
|
|
|
|
export const revalidate = 60;
|
|
|
|
/** Legacy `/blog/{slug-or-id}` → canonical `/blog/{id}/{titleSlug}`. */
|
|
export default async function LegacyBlogRedirect({
|
|
params,
|
|
}: {
|
|
params: Promise<{ id: string }>;
|
|
}) {
|
|
const { id } = await params;
|
|
|
|
const apiPost = await fetchBlogBySlug(id);
|
|
if (apiPost) redirect(blogHref(apiPost));
|
|
|
|
const local = getLocalBlogPost(id);
|
|
if (local) redirect(blogHref(local));
|
|
|
|
notFound();
|
|
}
|