Files
archicratie-edition/src/pages/robots.txt.ts
archicratia 60d88939b0
All checks were successful
CI / build-and-anchors (push) Successful in 1m25s
SMOKE / smoke (push) Successful in 11s
CI / build-and-anchors (pull_request) Successful in 1m20s
Seed from NAS prod snapshot 20260130-190531
2026-01-31 10:51:38 +00:00

23 lines
527 B
TypeScript

import type { APIRoute } from "astro";
export const prerender = true;
const robots = (sitemapURL: URL) => `User-agent: *
Allow: /
Disallow: /api/
Disallow: /pagefind/
Sitemap: ${sitemapURL.href}
`;
export const GET: APIRoute = ({ site }) => {
// site vient de astro.config (option "site")
const base = site ?? new URL("http://localhost:4321/");
const sitemapURL = new URL("sitemap-index.xml", base);
return new Response(robots(sitemapURL), {
headers: { "Content-Type": "text/plain; charset=utf-8" },
});
};