Separate children per family so Search Console reports the location layer's indexation apart from the school pages' — which is the point of the index built in W1, and the number the stop condition watches. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015mWQnpye9F299NVRCCSRvj
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}`);
|
|
}
|