feat: add sitemap.xml (#33)

Co-authored-by: saica.go <zephyird@gmail.com>
This commit is contained in:
CorrectRoad
2024-04-22 23:48:31 +08:00
committed by GitHub
parent e80999669a
commit 91773fc520
4 changed files with 49 additions and 0 deletions

16
src/pages/robots.txt.ts Normal file
View File

@@ -0,0 +1,16 @@
import type { APIRoute } from 'astro';
const robotsTxt = `
User-agent: *
Allow: /
Sitemap: ${new URL('sitemap-index.xml', import.meta.env.SITE).href}
`.trim();
export const GET: APIRoute = () => {
return new Response(robotsTxt, {
headers: {
'Content-Type': 'text/plain; charset=utf-8',
},
});
};