Skip to content

Commit ff71cf3

Browse files
committed
chore: show the last 13 items on changelog toc
1 parent bf15691 commit ff71cf3

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Diff for: src/components/layout/TheToc.vue

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
<script setup lang="ts">
22
const { theToc, currentSection } = useToc()
33
const { reload } = useCarbon()
4+
5+
const route = useRoute()
6+
7+
const pageToc = computed(() => {
8+
if (route.name === 'changelog') {
9+
const cutIndex = { ...theToc?.value[13] }
10+
11+
if (cutIndex) {
12+
const shorterToc = [...theToc.value].slice(0, 13)
13+
cutIndex.header = 'More...'
14+
shorterToc.push(cutIndex)
15+
return shorterToc
16+
}
17+
18+
return theToc.value
19+
}
20+
return theToc.value
21+
})
422
</script>
523

624
<template>
@@ -16,7 +34,7 @@ const { reload } = useCarbon()
1634
</h3>
1735

1836
<ul class="mt-4 text-sm">
19-
<li v-for="item in theToc" :key="item.id">
37+
<li v-for="item in pageToc" :key="item.id">
2038
<a
2139
:href="`#${item.id}`"
2240
class="block py-1 font-medium transition duration-200"
@@ -32,6 +50,6 @@ const { reload } = useCarbon()
3250
</ul>
3351
</div>
3452

35-
<carbon-ads v-if="!reload" class="mt-4" />
53+
<carbon-ads v-if="!reload" class="bottom-0" />
3654
</nav>
3755
</template>

0 commit comments

Comments
 (0)