mirror of
https://github.com/lbr77/blog-astro.git
synced 2026-04-10 09:39:11 +00:00
14 lines
289 B
TypeScript
14 lines
289 B
TypeScript
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))
|
|
}
|