feat: enhance toc UX
the3ash committed
Jul 11, 2025 at 13:13 UTC
1ca94b38fbe18df4a0cf08851d926a4812baeb09
1 file changed
+7
src/components/ui/TableOfContents.astro
+7
@@ -74,6 +74,13 @@ import { SITE } from '@/config'
74
}
75
})
76
77
+ // Hide TOC if there are no headings (only title)
78
+ const tocContainer = document.querySelector('.toc-container')
79
+ if (tocContainer && tocItems.length === 0) {
80
+ tocContainer.style.display = 'none'
81
+ return
82
+ }
83
+
84
// Clear existing TOC
85
tocList.innerHTML = ''
86