mirror of
https://github.com/KazooTTT/kazoottt-blog.git
synced 2025-06-23 18:51:31 +08:00
fix: use page to provide robot txt
This commit is contained in:
26
src/pages/robots.txt.ts
Normal file
26
src/pages/robots.txt.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import type { APIRoute } from 'astro'
|
||||
import { siteConfig } from '../site.config'
|
||||
|
||||
const robotsTxt = `
|
||||
User-agent: *
|
||||
Allow: /
|
||||
|
||||
HOST: ${siteConfig.site}
|
||||
|
||||
# Sitemaps
|
||||
Sitemap: ${siteConfig.site}/sitemap.xml
|
||||
|
||||
# Disallow system and error pages
|
||||
Disallow: /api/
|
||||
Disallow: /_astro/
|
||||
Disallow: /404
|
||||
Disallow: /500
|
||||
`
|
||||
|
||||
export const GET: APIRoute = () => {
|
||||
return new Response(robotsTxt.trim(), {
|
||||
headers: {
|
||||
'Content-Type': 'text/plain; charset=utf-8',
|
||||
},
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user