import { getConfig } from '../utils/config' /** * 动态 robots.txt(/robots.txt)。 * 提示搜索引擎可抓取,并指向动态 sitemap。 */ export default defineEventHandler(() => { const { siteUrl } = getConfig() const sitemapLine = siteUrl ? `${siteUrl}/sitemap.xml` : '/sitemap.xml' const body = `User-agent: * Allow: / Sitemap: ${sitemapLine} ` return new Response(body, { headers: { 'Content-Type': 'text/plain; charset=utf-8' }, }) })