From bb9f55a3b568726baed47fc09b55e939986d1570 Mon Sep 17 00:00:00 2001 From: Archicratia Date: Thu, 12 Mar 2026 12:04:46 +0100 Subject: [PATCH] feat(glossaire): extend taxonomy and align Astro 6 content config --- src/components/EditionToc.astro | 23 +- src/{content/config.ts => content.config.ts} | 2 +- src/content/cas-ia/annexe-glossaire-audit.mdx | 2 +- src/content/cas-ia/chapitre-1.mdx | 2 +- src/content/cas-ia/chapitre-2.mdx | 2 +- src/content/cas-ia/chapitre-3.mdx | 2 +- src/content/cas-ia/chapitre-4.mdx | 2 +- src/content/cas-ia/chapitre-5.mdx | 2 +- src/content/cas-ia/chapitre-6.mdx | 2 +- src/content/cas-ia/chapitre-7.mdx | 2 +- src/content/cas-ia/conclusion.mdx | 2 +- src/content/cas-ia/introduction.mdx | 1 - src/content/glossaire/arcalite.md | 4 +- src/content/glossaire/archicratie.md | 4 +- src/content/glossaire/archicration.md | 4 +- src/content/glossaire/co-viabilite.md | 6 +- src/content/glossaire/cratialite.md | 4 +- src/content/glossaire/tension.md | 48 +++ src/pages/api/glossaire.json.ts | 22 +- src/pages/glossaire/index.astro | 330 +++++++++++++++++- src/styles/global.css | 89 ++++- 21 files changed, 504 insertions(+), 51 deletions(-) rename src/{content/config.ts => content.config.ts} (96%) create mode 100644 src/content/glossaire/tension.md diff --git a/src/components/EditionToc.astro b/src/components/EditionToc.astro index f10e9b6..975f4e3 100644 --- a/src/components/EditionToc.astro +++ b/src/components/EditionToc.astro @@ -8,11 +8,20 @@ const { label = "Table des matières" } = Astro.props; -const entries = (await getCollection(collection)) - .sort((a, b) => (a.data.order ?? 0) - (b.data.order ?? 0)); +const slugOf = (entry) => String(entry.id).replace(/\.(md|mdx)$/i, ""); +const hrefOf = (entry) => `${basePath}/${slugOf(entry)}/`; -const routeSlug = (entry) => String(entry.id || "").replace(/\.(md|mdx)$/i, ""); -const href = (entry) => `${basePath}/${routeSlug(entry)}/`; +const collator = new Intl.Collator("fr", { sensitivity: "base", numeric: true }); + +const entries = [...await getCollection(collection)].sort((a, b) => { + const ao = Number(a.data.order ?? 9999); + const bo = Number(b.data.order ?? 9999); + if (ao !== bo) return ao - bo; + + const at = String(a.data.title ?? a.data.term ?? slugOf(a)); + const bt = String(b.data.title ?? b.data.term ?? slugOf(b)); + return collator.compare(at, bt); +}); ---