feat: inject French sitemap URLs into English sitemap via source endpoint

This commit is contained in:
2026-08-11 09:13:16 +00:00
parent d22711484b
commit d652949394
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -49,7 +49,8 @@ export default defineNuxtConfig({
sitemap: { sitemap: {
autoLastmod: true, autoLastmod: true,
urls: ['https://docu.djeex.fr'] urls: ['https://docu.djeex.fr'],
sources: ['/api/__sitemap__/urls']
}, },
compatibilityDate: '2024-10-24' compatibilityDate: '2024-10-24'
+10
View File
@@ -0,0 +1,10 @@
// fetches the deployed French sitemap and injects its URLs into the English sitemap
export default defineEventHandler(async () => {
try {
const xml = await $fetch<string>('https://docu.djeex.fr/fr/sitemap.xml')
const urls = [...xml.matchAll(/<loc>([^<]+)<\/loc>/g)].map(m => m[1])
return urls.map(loc => ({ loc }))
} catch {
return []
}
})