| 1 | /** |
| 2 | * /robots.txt (lib/robots.ts). Served from the request's own origin, so a |
| 3 | * self-hosted g1t names itself. |
| 4 | */ |
| 5 | import type { Route } from "./+types/robots-txt"; |
| 6 | import { robotsTxt } from "../lib/robots"; |
| 7 | |
| 8 | export function loader({ request }: Route.LoaderArgs) { |
| 9 | return new Response(robotsTxt(new URL(request.url).origin), { |
| 10 | headers: { |
| 11 | "content-type": "text/plain; charset=utf-8", |
| 12 | "cache-control": "public, max-age=86400", |
| 13 | }, |
| 14 | }); |
| 15 | } |