Block bots
This commit is contained in:
parent
90fc60e871
commit
6cdd20eedc
6 changed files with 110 additions and 2 deletions
38
src/data/ai_bots.ts
Normal file
38
src/data/ai_bots.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
export const AI_BOTS = [
|
||||
"AI2Bot",
|
||||
"Ai2Bot-Dolma",
|
||||
"Amazonbot",
|
||||
"Applebot",
|
||||
"Applebot-Extended",
|
||||
"Bytespider",
|
||||
"CCBot",
|
||||
"ChatGPT-User",
|
||||
"Claude-Web",
|
||||
"ClaudeBot",
|
||||
"Diffbot",
|
||||
"FacebookBot",
|
||||
"FriendlyCrawler",
|
||||
"GPTBot",
|
||||
"Google-Extended",
|
||||
"GoogleOther",
|
||||
"GoogleOther-Image",
|
||||
"GoogleOther-Video",
|
||||
"ICC-Crawler",
|
||||
"ImagesiftBot",
|
||||
"Meta-ExternalAgent",
|
||||
"Meta-ExternalFetcher",
|
||||
"OAI-SearchBot",
|
||||
"PerplexityBot",
|
||||
"PetalBot",
|
||||
"Scrapy",
|
||||
"Timpibot",
|
||||
"VelenPublicWebCrawler",
|
||||
"Webzio-Extended",
|
||||
"YouBot",
|
||||
"anthropic-ai",
|
||||
"cohere-ai",
|
||||
"facebookexternalhit",
|
||||
"img2dataset",
|
||||
"omgili",
|
||||
"omgilibot",
|
||||
];
|
||||
|
|
@ -152,7 +152,9 @@ const thumbnail =
|
|||
>
|
||||
<IconSun width="1.25rem" height="1.25rem" class="hidden dark:block" />
|
||||
<IconMoon width="1.25rem" height="1.25rem" class="block dark:hidden" />
|
||||
<span class="sr-only select-none" id="label-toggle-dark-mode">{t(props.lang, "published_content/toggle_dark_mode")}</span>
|
||||
<span class="sr-only select-none" id="label-toggle-dark-mode"
|
||||
>{t(props.lang, "published_content/toggle_dark_mode")}</span
|
||||
>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
18
src/pages/robots.txt.ts
Normal file
18
src/pages/robots.txt.ts
Normal 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" } });
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue