mirror of
https://github.com/ChenQihan666/MyBlog-Next.git
synced 2026-08-14 11:29:33 +08:00
feat: dynamically generate robots.txt
This commit is contained in:
@@ -1,5 +0,0 @@
|
|||||||
User-agent: Googlebot
|
|
||||||
Disallow: /nogooglebot/
|
|
||||||
|
|
||||||
User-agent: *
|
|
||||||
Allow: /
|
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import type { APIRoute } from "astro";
|
||||||
|
import { SITE } from "@config";
|
||||||
|
|
||||||
|
const robots = `
|
||||||
|
User-agent: Googlebot
|
||||||
|
Disallow: /nogooglebot/
|
||||||
|
|
||||||
|
User-agent: *
|
||||||
|
Allow: /
|
||||||
|
|
||||||
|
Sitemap: ${new URL("sitemap-index.xml", SITE.website).href}
|
||||||
|
`.trim();
|
||||||
|
|
||||||
|
export const GET: APIRoute = () =>
|
||||||
|
new Response(robots, {
|
||||||
|
headers: { "Content-Type": "text/plain" },
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user