feat: dynamically generate robots.txt

This commit is contained in:
tanishqmanuja
2023-09-27 15:53:39 +05:30
committed by Sat Naing
parent cfcedd1418
commit 6352353470
2 changed files with 17 additions and 5 deletions
-5
View File
@@ -1,5 +0,0 @@
User-agent: Googlebot
Disallow: /nogooglebot/
User-agent: *
Allow: /
+17
View File
@@ -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" },
});