feat: add toc default state setting

This commit is contained in:
Erzbir
2026-06-15 22:23:34 +08:00
parent b7a5ce82ac
commit bf7686d2a2
2 changed files with 14 additions and 1 deletions
+2 -1
View File
@@ -20,7 +20,8 @@
</section>
</article>
<nav id="toc" th:if="${theme.config.post_page.show_toc}" class="toc"
th:attr="data-default-open=${theme.config.style.fullscreen_layout ? 'false' : 'true'}">
th:with="tocDefaultOpen=${theme.config.post_page.toc_default_open ?: 'auto'}"
th:attr="data-default-open=${tocDefaultOpen == 'open' ? 'true' : (tocDefaultOpen == 'closed' ? 'false' : (theme.config.style.fullscreen_layout ? 'false' : 'true'))}">
<button id="toc-toggle" class="toc-toggle" aria-label="Hide Table of Contents"></button>
<div id="toc-content" class="toc-content"></div>
</nav>