Files
yingfungsolar/src/pages/robots.txt.ts
T
2026-09-11 15:49:41 +08:00

15 lines
351 B
TypeScript

import type { APIRoute } from "astro";
export const GET: APIRoute = ({ site }) => {
const origin = (site ?? new URL("https://example.com")).toString().replace(/\/$/, "");
return new Response(
`User-agent: *
Allow: /
Disallow: /admin
Sitemap: ${origin}/sitemap.xml
`,
{ headers: { "Content-Type": "text/plain; charset=utf-8" } },
);
};