import type { APIRoute } from 'astro'; // List of all pages const pages = [ '', '/services', '/contact' ]; // Function to generate sitemap export const GET: APIRoute = async ({ site }) => { if (!site) { return new Response('Site configuration error', { status: 500 }); } const siteUrl = site.toString(); const currentDate = new Date().toISOString().split('T')[0]; return new Response( ` ${pages.map(page => ` ${siteUrl}${page} ${currentDate} ${page === '' ? 'daily' : 'weekly'} ${page === '' ? '1.0' : '0.7'} `).join('')} `, { headers: { 'Content-Type': 'application/xml', }, } ); };