Files
blog/src/pages/sitemap.xml.ts
2026-08-15 20:55:56 +08:00

22 lines
491 B
TypeScript

import type {APIRoute} from 'astro';
import {siteConfig} from "@/consts";
const site = siteConfig.site
export const GET: APIRoute = () => {
const xml = `<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<sitemap>
<loc>${site}/sitemap-pages.xml</loc>
</sitemap>
<sitemap>
<loc>${site}/sitemap-posts.xml</loc>
</sitemap>
</sitemapindex>`;
return new Response(xml, {
headers: {
'Content-Type': 'application/xml; charset=utf-8',
},
});
};