The root layout was stamping the homepage title and production root onto every page. Routes now supply a page segment through one em-dash template, canonicals follow the request path, and non-production hosts disallow crawlers. Co-authored-by: Cursor <cursoragent@cursor.com>
37 rivejä
1.2 KiB
TypeScript
37 rivejä
1.2 KiB
TypeScript
import type { Metadata } from "next";
|
|
import { notFound } from "next/navigation";
|
|
import { CreateFlowScreenView } from "../screens/CreateFlowScreenView";
|
|
import { createFlowStepPath, CREATE_ROUTES } from "../utils/createFlowPaths";
|
|
import { isValidStep } from "../utils/flowSteps";
|
|
import type { CreateFlowStep } from "../types";
|
|
import { routeMetadata } from "../../../../lib/siteMetadata";
|
|
|
|
/**
|
|
* Single dynamic route for the whole create wizard (every step in `FLOW_STEP_ORDER`).
|
|
*
|
|
* Only **canonical** `screenId` values from `CreateFlowStep` are valid. Old placeholder
|
|
* segments from pre-product shells are not redirected — unknown slugs `notFound()`.
|
|
*/
|
|
|
|
interface PageProps {
|
|
params: Promise<{ screenId: string }>;
|
|
}
|
|
|
|
export async function generateMetadata({ params }: PageProps): Promise<Metadata> {
|
|
const { screenId: raw } = await params;
|
|
const path = isValidStep(raw)
|
|
? createFlowStepPath(raw)
|
|
: `${CREATE_ROUTES.createRoot}/${raw}`;
|
|
return routeMetadata(path);
|
|
}
|
|
|
|
export default async function CreateFlowScreenPage({ params }: PageProps) {
|
|
const { screenId: raw } = await params;
|
|
|
|
if (!isValidStep(raw)) {
|
|
notFound();
|
|
}
|
|
|
|
return <CreateFlowScreenView screenId={raw as CreateFlowStep} />;
|
|
}
|