feat(glossaire): extend taxonomy and align Astro 6 content config
All checks were successful
SMOKE / smoke (push) Successful in 6s
CI / build-and-anchors (push) Successful in 44s
CI / build-and-anchors (pull_request) Successful in 41s

This commit is contained in:
2026-03-12 12:04:46 +01:00
parent 37cb836246
commit bb9f55a3b5
21 changed files with 504 additions and 51 deletions

View File

@@ -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);
});
---
<nav class="toc-global" aria-label={label}>
@@ -22,12 +31,12 @@ const href = (entry) => `${basePath}/${routeSlug(entry)}/`;
<ol class="toc-global__list">
{entries.map((e) => {
const entrySlug = routeSlug(e);
const active = entrySlug === currentSlug;
const slug = slugOf(e);
const active = slug === currentSlug;
return (
<li class={`toc-item ${active ? "is-active" : ""}`}>
<a class="toc-link" href={href(e)} aria-current={active ? "page" : undefined}>
<a class="toc-link" href={hrefOf(e)} aria-current={active ? "page" : undefined}>
<span class="toc-link__row">
{active ? (
<span class="toc-active-indicator" aria-hidden="true">👉</span>