fix(seo): B23 — fiches du sitemap en fonction pure testée (jamais le repli seed, Id nul ignoré) — checkpoint AEP 22/10
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AB8CwgrRNDCUvEnhvL5wRP
This commit is contained in:
co-authored by
Claude Fable 5.1
parent
f9ce7a495a
commit
902517bd3c
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
// @ts-expect-error module virtuel posé par modules/seo-routes.ts
|
||||
import routes from '#seo-routes'
|
||||
import { SITE_AEP, SITE_EVENT, cheminsSitemap, dateSitemap, estHoteEvent, sitemapXml, type EntreeSitemap } from '../../utils/seo'
|
||||
import { SITE_AEP, SITE_EVENT, cheminsSitemap, entreesFichesSitemap, estHoteEvent, sitemapXml, type EntreeSitemap } from '../../utils/seo'
|
||||
|
||||
export default defineCachedEventHandler(async (event) => {
|
||||
const host = getRequestHost(event, { xForwardedHost: true })
|
||||
@@ -13,14 +13,9 @@ export default defineCachedEventHandler(async (event) => {
|
||||
const entrees: EntreeSitemap[] = cheminsSitemap(routes as string[], host).map(p => ({ loc: site + (p === '/' ? '/' : p) }))
|
||||
|
||||
if (!estHoteEvent(host)) {
|
||||
const data: any = await $fetch('/api/organisations').catch(() => null)
|
||||
// Le repli « seed » porte des Id fictifs (1000+) : jamais dans le sitemap.
|
||||
if (data?.source === 'nocodb') {
|
||||
for (const r of data.list ?? []) {
|
||||
if (r?.Id == null) continue
|
||||
entrees.push({ loc: `${SITE_AEP}/fiche/${r.Id}`, lastmod: dateSitemap(r.UpdatedAt ?? r.updated_at ?? r.CreatedAt) })
|
||||
}
|
||||
}
|
||||
const data = await $fetch('/api/organisations').catch(() => null)
|
||||
// Le repli « seed » porte des Id fictifs (1000+) : jamais dans le sitemap (règle portée et testée par entreesFichesSitemap).
|
||||
entrees.push(...entreesFichesSitemap(data, SITE_AEP))
|
||||
}
|
||||
|
||||
setHeader(event, 'Content-Type', 'application/xml; charset=utf-8')
|
||||
|
||||
Reference in New Issue
Block a user