diff --git a/website/public/robots.txt b/website/src/pages/robots.txt.ts similarity index 61% rename from website/public/robots.txt rename to website/src/pages/robots.txt.ts index b437f516e..d4dec7971 100644 --- a/website/public/robots.txt +++ b/website/src/pages/robots.txt.ts @@ -1,5 +1,10 @@ -# BMAD Method Documentation -# https://docs.bmad-method.org/ +import type { APIRoute } from 'astro'; + +export const GET: APIRoute = ({ site }) => { + const siteUrl = site?.href.replace(/\/$/, '') ?? ''; + + const body = `# BMAD Method Documentation +# ${siteUrl}/ # # This file controls web crawler access to the documentation site. @@ -34,4 +39,10 @@ User-agent: cohere-ai Allow: / # Sitemap -Sitemap: https://docs.bmad-method.org/sitemap-index.xml +Sitemap: ${siteUrl}/sitemap-index.xml +`; + + return new Response(body, { + headers: { 'Content-Type': 'text/plain; charset=utf-8' }, + }); +};