import type { RequestHandler } from './$types'; import { locationPages } from '$lib/content/locations'; const siteUrl = 'https://www.goodwalk.co.nz'; interface SitemapRoute { path: string; priority: string; changefreq: string; } const routes: SitemapRoute[] = [ { path: '/', priority: '1.0', changefreq: 'weekly' }, { path: '/pack-walks', priority: '0.9', changefreq: 'monthly' }, { path: '/dog-walking', priority: '0.9', changefreq: 'monthly' }, { path: '/puppy-visits', priority: '0.9', changefreq: 'monthly' }, { path: '/our-pricing', priority: '0.8', changefreq: 'monthly' }, { path: '/about', priority: '0.7', changefreq: 'monthly' }, { path: '/contact-us', priority: '0.7', changefreq: 'monthly' }, ...locationPages.map((loc) => ({ path: `/locations/${loc.slug}`, priority: '0.8', changefreq: 'monthly' })), { path: '/terms-and-conditions', priority: '0.3', changefreq: 'yearly' }, { path: '/privacy-policy', priority: '0.3', changefreq: 'yearly' } ]; export const GET: RequestHandler = () => { const lastmod = new Date().toISOString().split('T')[0]; const body = ` ${routes .map( ({ path, priority, changefreq }) => ` ${siteUrl}${path} ${lastmod} ${changefreq} ${priority} ` ) .join('\n')} `; return new Response(body, { headers: { 'Content-Type': 'application/xml; charset=utf-8' } }); };