Merged in fix/sitemap-route (pull request #1801)

Fix: sitemap - now the route works

* Fix: sitemap - now the route works


Approved-by: Joakim Jäderberg
This commit is contained in:
Linus Flood
2025-04-15 07:53:11 +00:00
parent b48cd5524e
commit 1689039c39
3 changed files with 13 additions and 1 deletions

View File

@@ -17,6 +17,9 @@ export async function GET(
}
const sitemapId = context.params.sitemapId
console.log("[SITEMAP] Fetching sitemap by ID", sitemapId)
if (!sitemapId) {
notFound()
}

View File

@@ -11,9 +11,18 @@ export async function GET() {
notFound()
}
console.log(`[SITEMAP] Fetching sitemap`)
const lastUpdated = await getLastUpdated()
const sitemaps = await getSitemapIds()
if (!sitemaps || sitemaps.length === 0) {
return new Response("No sitemaps found", { status: 404 })
}
console.log(`[SITEMAP] Sitemaps retrieved: ${sitemaps.length}`)
const urls = sitemaps.map(
(id) => `<sitemap>
<loc>${env.PUBLIC_URL}/sitemap-${id}.xml</loc>