38 lines
877 B
TypeScript
38 lines
877 B
TypeScript
import type { RequestHandler } from './$types';
|
|
|
|
const siteUrl = 'https://www.goodwalk.co.nz';
|
|
const routes = [
|
|
'/',
|
|
'/pack-walks',
|
|
'/dog-walking',
|
|
'/puppy-visits',
|
|
'/our-pricing',
|
|
'/about',
|
|
'/contact-us',
|
|
'/terms-and-conditions',
|
|
'/privacy-policy'
|
|
];
|
|
|
|
export const GET: RequestHandler = () => {
|
|
const lastmod = new Date().toISOString().split('T')[0];
|
|
const body = `<?xml version="1.0" encoding="UTF-8"?>
|
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
${routes
|
|
.map(
|
|
(path) => ` <url>
|
|
<loc>${siteUrl}${path}</loc>
|
|
<lastmod>${lastmod}</lastmod>
|
|
<changefreq>${path === '/' ? 'weekly' : 'monthly'}</changefreq>
|
|
<priority>${path === '/' ? '1.0' : '0.8'}</priority>
|
|
</url>`
|
|
)
|
|
.join('\n')}
|
|
</urlset>`;
|
|
|
|
return new Response(body, {
|
|
headers: {
|
|
'Content-Type': 'application/xml; charset=utf-8'
|
|
}
|
|
});
|
|
};
|