Files
docudjeex/server/api/__sitemap__/urls.ts
T

11 lines
363 B
TypeScript

// 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 []
}
})