feat: sitemap

This commit is contained in:
TrèsAbhi committed 2024-10-14 10:52:40 -05:00
1 parent dfc55b745b
commit 5a5643ce3d
5 files changed
+17 -12

No files matched your search

+12 -11
View File
@@ -3,18 +3,19 @@ import type { APIContext } from 'astro';
export async function GET({}: APIContext) {
const allowRobots = assertSecret(import.meta.env.ALLOW_ROBOTS) === 'true';
const site = assertSecret(import.meta.env.SITE);
return new Response(`
User-agent: *
${allowRobots ? 'Allow' : 'Disallow'}: /
User-agent: *
${allowRobots ? 'Allow' : 'Disallow'}: /
${
allowRobots
? `
Host: https://blitzkit.app
Sitemap: https://blitzkit.app/sitemap.txt
`
: ''
}
`);
${
allowRobots
? `
Host: ${site}
Sitemap: ${site}/sitemap-index.xml
`
: ''
}
`);
}