fix: remove duplicate sitemap route
- app/sitemap.ts already generates the sitemap index via generateSitemaps() - app/sitemap.xml/route.ts was a duplicate manual version at the same path
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import { generateSitemaps } from "@/app/sitemap"
|
||||
import { getBaseUrl } from "@/lib/sitemap-utils"
|
||||
|
||||
export const revalidate = 3600
|
||||
|
||||
export async function GET() {
|
||||
const baseUrl = getBaseUrl()
|
||||
const sitemaps = await generateSitemaps()
|
||||
|
||||
const entries = sitemaps
|
||||
.map(({ id }) => ` <sitemap>\n <loc>${baseUrl}/sitemap/${id}.xml</loc>\n </sitemap>`)
|
||||
.join("\n")
|
||||
|
||||
const xml = [
|
||||
`<?xml version="1.0" encoding="UTF-8"?>`,
|
||||
`<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`,
|
||||
entries,
|
||||
`</sitemapindex>`,
|
||||
].join("\n")
|
||||
|
||||
return new Response(xml, {
|
||||
headers: {
|
||||
"Content-Type": "application/xml",
|
||||
"Cache-Control": "public, max-age=3600, s-maxage=3600, stale-while-revalidate=86400",
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user