fix: update TOC handling logic to use showToc flag

This commit is contained in:
Cell
2025-12-25 17:16:07 +08:00
parent 3482b8bf08
commit 8ffb9a9563
3 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -9,6 +9,7 @@
{{- $toc := .Store.Get "toc" -}}
{{- $tableOfContents := .Fragments.ToHTML ($toc.startlevel | int) ($toc.endlevel | int) ($toc.ordered | default false) -}}
{{- $showToc := $toc.enable | and (ne $tableOfContents `<nav id="TableOfContents"></nav>`) -}}
{{- .Store.Set "showToc" $showToc -}}
{{- $tableOfContents = dict "Content" $tableOfContents "Ruby" $params.ruby "Fraction" $params.fraction "Fontawesome" $params.fontawesome | partial "function/content.html" | safeHTML -}}
<aside class="aside-collection animate__animated animate__fadeIn animate__faster" aria-label="{{ T "collections" }}">
@@ -234,7 +235,6 @@
{{- /* TOC Dialog */ -}}
{{- if $showToc -}}
{{- .Page.Store.Set "hasToc" true -}}
<dialog id="toc-dialog" aria-labelledby="toc-dialog-title" role="dialog">
<div class="toc">
<h2 class="toc-title">{{ T "single.contents" }}</h2>