Files
librodrome/app/components/book/ChapterNav.vue
Yvv dd1d8baf4f Fix 404 chapitres : stem Nuxt Content inclut le dossier parent
Le `chapter.stem` de Nuxt Content renvoie `book/01-introduction` et non
`01-introduction`. Extraction du slug final via `.split('/').pop()` dans
les liens et la navigation prev/next.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-26 20:46:19 +01:00

28 lines
964 B
Vue

<template>
<nav class="chapter-nav" aria-label="Navigation des chapitres">
<h2 class="mb-4 font-display text-sm font-semibold uppercase tracking-wider text-white/40">
Chapitres
</h2>
<ul class="flex flex-col gap-1">
<li v-for="chapter in chapters" :key="chapter.path">
<NuxtLink
:to="`/modele-eco/${chapter.stem?.split('/').pop()}`"
class="flex items-center gap-3 rounded-lg px-3 py-2 text-sm transition-colors hover:bg-white/5"
active-class="bg-primary/10 text-primary font-medium"
>
<span class="font-mono text-xs text-white/30 w-5 text-right">
{{ chapter.order }}
</span>
<span class="truncate">{{ chapter.title }}</span>
</NuxtLink>
</li>
</ul>
</nav>
</template>
<script setup lang="ts">
const { data: chapters } = await useAsyncData('book-chapters', () =>
queryCollection('book').order('order', 'ASC').all(),
)
</script>