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>
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
<ul class="flex flex-col gap-1">
|
<ul class="flex flex-col gap-1">
|
||||||
<li v-for="chapter in chapters" :key="chapter.path">
|
<li v-for="chapter in chapters" :key="chapter.path">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:to="`/modele-eco/${chapter.stem}`"
|
: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"
|
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"
|
active-class="bg-primary/10 text-primary font-medium"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
<nav class="mt-16 flex items-center justify-between border-t border-white/8 pt-8">
|
<nav class="mt-16 flex items-center justify-between border-t border-white/8 pt-8">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-if="prevChapter"
|
v-if="prevChapter"
|
||||||
:to="`/modele-eco/${prevChapter.stem}`"
|
:to="`/modele-eco/${prevChapter.stem?.split('/').pop()}`"
|
||||||
class="btn-ghost gap-2"
|
class="btn-ghost gap-2"
|
||||||
>
|
>
|
||||||
<div class="i-lucide-arrow-left h-4 w-4" />
|
<div class="i-lucide-arrow-left h-4 w-4" />
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-if="nextChapter"
|
v-if="nextChapter"
|
||||||
:to="`/modele-eco/${nextChapter.stem}`"
|
:to="`/modele-eco/${nextChapter.stem?.split('/').pop()}`"
|
||||||
class="btn-ghost gap-2"
|
class="btn-ghost gap-2"
|
||||||
>
|
>
|
||||||
<span class="text-sm">{{ nextChapter.title }}</span>
|
<span class="text-sm">{{ nextChapter.title }}</span>
|
||||||
@@ -64,7 +64,7 @@ const { data: allChapters } = await useAsyncData('book-nav', () =>
|
|||||||
)
|
)
|
||||||
|
|
||||||
const currentIndex = computed(() =>
|
const currentIndex = computed(() =>
|
||||||
allChapters.value?.findIndex(c => c.stem === slug) ?? -1,
|
allChapters.value?.findIndex(c => c.stem?.split('/').pop() === slug) ?? -1,
|
||||||
)
|
)
|
||||||
|
|
||||||
const prevChapter = computed(() => {
|
const prevChapter = computed(() => {
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
:key="chapter.path"
|
:key="chapter.path"
|
||||||
>
|
>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:to="`/modele-eco/${chapter.stem}`"
|
:to="`/modele-eco/${chapter.stem?.split('/').pop()}`"
|
||||||
class="card-surface flex items-start gap-4 group"
|
class="card-surface flex items-start gap-4 group"
|
||||||
>
|
>
|
||||||
<span class="font-mono text-2xl font-bold text-primary/30 leading-none mt-1 w-10 text-right flex-shrink-0">
|
<span class="font-mono text-2xl font-bold text-primary/30 leading-none mt-1 w-10 text-right flex-shrink-0">
|
||||||
@@ -109,7 +109,7 @@
|
|||||||
<span class="i-lucide-clock inline-block h-3 w-3 mr-1 align-middle" />
|
<span class="i-lucide-clock inline-block h-3 w-3 mr-1 align-middle" />
|
||||||
{{ chapter.readingTime }}
|
{{ chapter.readingTime }}
|
||||||
</span>
|
</span>
|
||||||
<SongBadges :chapter-slug="chapter.stem!" />
|
<SongBadges :chapter-slug="chapter.stem?.split('/').pop() ?? ''" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="i-lucide-chevron-right h-5 w-5 text-white/20 group-hover:text-primary/60 transition-colors flex-shrink-0 mt-2" />
|
<div class="i-lucide-chevron-right h-5 w-5 text-white/20 group-hover:text-primary/60 transition-colors flex-shrink-0 mt-2" />
|
||||||
|
|||||||
Reference in New Issue
Block a user