Add Table of Contents (TOC) to article pages

This commit is contained in:
Riyyi
2025-03-31 21:59:08 +02:00
parent 8c68390c07
commit 8110667234
9 changed files with 138 additions and 26 deletions
@@ -0,0 +1,18 @@
<template>
<ul>
<template v-for="link in links" :key="link.id">
<li>
<a :href="'#' + link.id">{{ link.text }}</a>
</li>
<template v-if="link.children && link.children?.length > 0">
<ArticlesTableOfContentsLink :links="link.children" :first="false" />
</template>
</template>
</ul>
</template>
<script setup lang="ts">
import type { TocLink } from "@nuxtjs/mdc";
defineProps<{ links: TocLink[] }>();
</script>