diff options
| author | seth <[email protected]> | 2024-10-09 10:59:13 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-10-09 10:59:13 -0400 |
| commit | d17bca56238e9ca326d60e58230d0d354f23bfe8 (patch) | |
| tree | 12aee4c37a1490914e6307ce1b0023be2df93105 /src/pages/robots.txt.ts | |
| parent | 7d6495399d5e1ba429a339de1c3a00f121e89305 (diff) | |
back to astro for hopefully the last time (#146)
Diffstat (limited to 'src/pages/robots.txt.ts')
| -rw-r--r-- | src/pages/robots.txt.ts | 13 |
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..f36bf2b --- /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)); +}; |
