// src/app/sitemap.xml/route.ts import { NextResponse } from 'next/server'; import { generateAllSeoUrls, SITEMAP_CHUNK_SIZE } from '@/lib/seo'; export const dynamic = 'force-dynamic'; export const revalidate = 86400; // 24 heures export async function GET() { const allUrls = generateAllSeoUrls(); const totalChunks = Math.ceil(allUrls.length / SITEMAP_CHUNK_SIZE); const now = new Date().toISOString(); let xml = '\n'; xml += '\n'; // Sitemap statique des pages principales xml += ' \n'; xml += ` https://www.wisebil.com/sitemap/static.xml\n`; xml += ` ${now}\n`; xml += ' \n'; // Sitemaps par tranche programmatique for (let i = 0; i < totalChunks; i++) { xml += ' \n'; xml += ` https://www.wisebil.com/sitemap/${i}.xml\n`; xml += ` ${now}\n`; xml += ' \n'; } xml += ''; return new NextResponse(xml, { status: 200, headers: { 'Content-Type': 'application/xml', 'Cache-Control': 'public, s-maxage=86400, stale-while-revalidate=43200', }, }); }