import { posts } from '$lib/blog/posts'; import { canonical } from '$lib/config/site'; const staticPages = ['/', '/about', '/blog', '/dashboard']; export const GET = () => { const urls = [ ...staticPages.map((path) => ({ loc: canonical(path), lastmod: undefined })), ...posts.map((post) => ({ loc: canonical(`/blog/${post.slug}`), lastmod: post.date })) ]; const body = ` ${urls .map( (url) => ` ${url.loc}${url.lastmod ? `\n ${url.lastmod}` : ''} ` ) .join('\n')} `; return new Response(body, { headers: { 'content-type': 'application/xml; charset=utf-8', 'cache-control': 'public, max-age=3600' } }); };