aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/robots.txt.ts
diff options
context:
space:
mode:
authoraman333nolawz <amananudhiu@gmail.com>2026-03-02 21:49:13 +0530
committeraman333nolawz <amananudhiu@gmail.com>2026-03-02 21:49:13 +0530
commitd41eff9eccf66644c4c60f53cb516bf079937a28 (patch)
tree248a0863a3181369f943d678ec4273911d35efac /src/pages/robots.txt.ts
Using astro-erudite for static site generation
Diffstat (limited to 'src/pages/robots.txt.ts')
-rw-r--r--src/pages/robots.txt.ts13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/pages/robots.txt.ts b/src/pages/robots.txt.ts
new file mode 100644
index 0000000..679a44d
--- /dev/null
+++ b/src/pages/robots.txt.ts
@@ -0,0 +1,13 @@
+import type { APIRoute } from 'astro'
+
+const getRobotsTxt = (sitemapURL: URL) => `
+User-agent: *
+Allow: /
+
+Sitemap: ${sitemapURL.href}
+`
+
+export const GET: APIRoute = ({ site }) => {
+ const sitemapURL = new URL('sitemap-index.xml', site)
+ return new Response(getRobotsTxt(sitemapURL))
+}