Block bots

This commit is contained in:
Bad Manners 2024-09-04 18:10:14 -03:00
parent 90fc60e871
commit 6cdd20eedc
No known key found for this signature in database
GPG key ID: 8C88292CCB075609
6 changed files with 110 additions and 2 deletions

18
src/pages/robots.txt.ts Normal file
View file

@ -0,0 +1,18 @@
import type { APIRoute } from "astro";
import { AI_BOTS } from "../data/ai_bots";
export const GET: APIRoute = async () => {
const robots = [
AI_BOTS.map((bot) => `User-agent: ${bot}`),
"Disallow: /",
"",
"User-agent: *",
"Disallow: .htaccess",
"Disallow: /stories/drafts/",
"Disallow: /games/drafts/",
]
.flat()
.join("\n");
return new Response(robots, { headers: { "Content-Type": "text/plain; charset=utf-8" } });
};