import { SITE, membres } from '$lib/data/gong';
import { getActualites } from '$lib/server/actualites';
import { getArchives } from '$lib/server/archives';
export const prerender = true;
const statiques: { path: string; priority: string; changefreq: string }[] = [
{ path: '/', priority: '1.0', changefreq: 'monthly' },
{ path: '/histoire/', priority: '0.9', changefreq: 'yearly' },
{ path: '/me-67/', priority: '0.9', changefreq: 'yearly' },
{ path: '/proces-1968/', priority: '0.8', changefreq: 'yearly' },
{ path: '/militants/', priority: '0.8', changefreq: 'yearly' },
{ path: '/ideologie/', priority: '0.7', changefreq: 'yearly' },
{ path: '/heritage/', priority: '0.7', changefreq: 'yearly' },
{ path: '/publications/', priority: '0.6', changefreq: 'yearly' },
{ path: '/archives/', priority: '0.8', changefreq: 'yearly' },
{ path: '/charte/', priority: '0.7', changefreq: 'yearly' },
{ path: '/orientation/', priority: '0.7', changefreq: 'yearly' },
{ path: '/sources/', priority: '0.6', changefreq: 'yearly' },
{ path: '/faq/', priority: '0.8', changefreq: 'monthly' },
{ path: '/actualites/', priority: '0.6', changefreq: 'weekly' },
{ path: '/contact/', priority: '0.4', changefreq: 'yearly' },
{ path: '/mentions-legales/', priority: '0.2', changefreq: 'yearly' }
];
export function GET() {
const today = new Date().toISOString().slice(0, 10);
const urls: string[] = [];
for (const s of statiques) {
urls.push(
`${SITE.url}${s.path}${today}${s.changefreq}${s.priority}`
);
}
for (const m of membres) {
urls.push(`${SITE.url}/militants/${m.slug}/${today}yearly0.6`);
}
for (const a of getActualites()) {
urls.push(`${SITE.url}/actualites/${a.slug}/${a.iso}monthly0.5`);
}
for (const a of getArchives()) {
urls.push(`${SITE.url}/archives/${a.slug}/${a.iso}yearly0.6`);
}
const xml = `
${urls.join('\n')}
`;
return new Response(xml, {
headers: { 'Content-Type': 'application/xml', 'Cache-Control': 'max-age=3600' }
});
}