fix robots file

This commit is contained in:
Juan Carlos Manzanero Domínguez
2024-07-01 13:15:38 -06:00
parent 60136383ef
commit 53c56e05b8
5 changed files with 66 additions and 0 deletions

View File

@ -25,6 +25,7 @@ const { title, description, lang } = Astro.props;
type="application/rss+xml"
href={new URL("rss.xml", Astro.site)}
/>
<link rel="sitemap" href="/sitemap-index.xml" />
<meta name="generator" content={Astro.generator} />
<title>{title}</title>
</head>

16
src/pages/robots.txt.ts Normal file
View File

@ -0,0 +1,16 @@
import type { APIRoute } from "astro";
const robotsTxt = `
User-agent: *
Allow: /
Sitemap: ${new URL("sitemap-index.xml", import.meta.env.SITE).href}
`.trim();
export const GET: APIRoute = () => {
return new Response(robotsTxt, {
headers: {
"Content-Type": "text/plain; charset=utf-8",
},
});
};