Add table of content for blog page and fixed minor issue
Signed-off-by: Al Asad Nur Riyad <alasadnurriyad@Als-MacBook-Pro.local>
This commit is contained in:
17
components/blog/Toc.vue
Normal file
17
components/blog/Toc.vue
Normal file
@@ -0,0 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
const { path } = useRoute()
|
||||
const articles = await queryContent(path).findOne()
|
||||
|
||||
const links = articles.body.toc.links
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="lg:col-span-3 sticky top-28 h-96 p-2 hidden lg:block justify-self-end">
|
||||
<h1 class="text-lg font-bold mb-4">
|
||||
Table Of Content
|
||||
</h1>
|
||||
<NuxtLink v-for="link in links" :key="link.id" :to="`#${link.id}`" class="block text-md mb-3">
|
||||
{{ link.text }}
|
||||
</NuxtLink>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user