feat: add toc default state setting
This commit is contained in:
@@ -255,6 +255,18 @@ spec:
|
||||
name: show_toc
|
||||
label: 显示文章目录
|
||||
value: true
|
||||
- $formkit: select
|
||||
name: toc_default_open
|
||||
label: 文章目录默认状态
|
||||
value: "auto"
|
||||
help: 自动模式会在普通布局默认展开, 全屏布局默认收起
|
||||
options:
|
||||
- label: "自动"
|
||||
value: "auto"
|
||||
- label: "默认展开"
|
||||
value: "open"
|
||||
- label: "默认收起"
|
||||
value: "closed"
|
||||
- $formkit: checkbox
|
||||
name: show_tags
|
||||
label: 显示文章标签
|
||||
|
||||
+2
-1
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user