1 |
import { absoluteURL } from "@/utils/utils"; |
2 |
import { NextResponse } from "next/server"; |
3 |
|
4 |
export async function GET() { |
5 |
const sitemaps = ["/sitemap.xml", "/blog/sitemap.xml"]; |
6 |
|
7 |
return new NextResponse( |
8 |
`<?xml version="1.0" encoding="UTF-8"?>\n |
9 |
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> |
10 |
${sitemaps.map(sitemap => `<sitemap><loc>${absoluteURL(sitemap)}</loc></sitemap>`).join("")} |
11 |
</sitemapindex> |
12 |
`, |
13 |
{ |
14 |
headers: { |
15 |
"Content-Type": "application/xml", |
16 |
}, |
17 |
}, |
18 |
); |
19 |
} |