Payload's admin panel ships its own root layout rendering html/body. Next allows multiple root layouts only when no app/layout.tsx exists, so the site's routes move into their own group. Route groups are invisible to routing: every public URL is unchanged, verified against the build's route table. The metadata file conventions deliberately stay at the app/ root. Moving them into the group renamed /icon.png to /icon-4usi79.png (likewise apple-icon and opengraph-image) and dropped /robots.txt altogether, which would have broken the /icon.png cache-control rule, the outputFileTracingIncludes entry for the share card, and robots.txt. darkThemeSafety reads app/globals.css off disk rather than importing it, so it needed its own path fix — a grep for import specifiers misses it, and it fails as an unrunnable suite rather than a failed assertion. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017YmbBhr8s7GusjDE12hrZM
25 lines
750 B
TypeScript
25 lines
750 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { proxySitemap } from '@/lib/sitemapProxy';
|
|
|
|
export const dynamic = 'force-dynamic';
|
|
export const runtime = 'nodejs';
|
|
|
|
/**
|
|
* Children are /sitemaps/static.xml and /sitemaps/schools-{n}.xml. The name is
|
|
* validated here rather than passed through, so this route cannot be used to
|
|
* reach arbitrary backend paths.
|
|
*/
|
|
const CHILD = /^(static|schools-\d+|places-\d+|outcodes-\d+)\.xml$/;
|
|
|
|
export async function GET(
|
|
_request: Request,
|
|
{ params }: { params: Promise<{ parts: string[] }> },
|
|
) {
|
|
const { parts } = await params;
|
|
const name = parts.join('/');
|
|
if (!CHILD.test(name)) {
|
|
return new NextResponse('Not found', { status: 404 });
|
|
}
|
|
return proxySitemap(`/sitemaps/${name}`);
|
|
}
|