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>
13 lines
406 B
TypeScript
13 lines
406 B
TypeScript
import type { MetadataRoute } from "next";
|
|
import { headers } from "next/headers";
|
|
import { buildRobots, resolveRequestHost } from "../lib/siteMetadata";
|
|
|
|
export default async function robots(): Promise<MetadataRoute.Robots> {
|
|
const headerStore = await headers();
|
|
const host = resolveRequestHost(
|
|
headerStore.get("x-forwarded-host"),
|
|
headerStore.get("host"),
|
|
);
|
|
return buildRobots(host);
|
|
}
|