chore(astro): upgrade to Astro 6 and fix dynamic collection routes
All checks were successful
SMOKE / smoke (push) Successful in 3s
CI / build-and-anchors (push) Successful in 42s
CI / build-and-anchors (pull_request) Successful in 44s

This commit is contained in:
2026-03-11 17:56:53 +01:00
parent 683b02f4a0
commit 37cb836246

View File

@@ -11,7 +11,8 @@ const {
const entries = (await getCollection(collection))
.sort((a, b) => (a.data.order ?? 0) - (b.data.order ?? 0));
const href = (slug) => `${basePath}/${slug}/`;
const routeSlug = (entry) => String(entry.id || "").replace(/\.(md|mdx)$/i, "");
const href = (entry) => `${basePath}/${routeSlug(entry)}/`;
---
<nav class="toc-global" aria-label={label}>
@@ -21,10 +22,12 @@ const href = (slug) => `${basePath}/${slug}/`;
<ol class="toc-global__list">
{entries.map((e) => {
const active = e.slug === currentSlug;
const entrySlug = routeSlug(e);
const active = entrySlug === currentSlug;
return (
<li class={`toc-item ${active ? "is-active" : ""}`}>
<a class="toc-link" href={href(e.slug)} aria-current={active ? "page" : undefined}>
<a class="toc-link" href={href(e)} aria-current={active ? "page" : undefined}>
<span class="toc-link__row">
{active ? (
<span class="toc-active-indicator" aria-hidden="true">👉</span>