Skip to content

Commit

Permalink
🐛 Fix: don's show emtpy toc
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Oct 1, 2024
1 parent ed8cf31 commit b44555d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion layouts/partials/init/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.13-b029036c" -}}
{{- .Scratch.Set "version" "v0.3.13-ed8cf316" -}}
{{- .Scratch.Set "this" dict -}}

{{- partial "init/detection-env.html" . -}}
Expand Down
4 changes: 2 additions & 2 deletions layouts/posts/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
{{- $title := title .Title -}}
{{- $params := partial "function/params.html" -}}
{{- $toc := .Scratch.Get "toc" -}}
{{- $showToc := $toc.enable | and (gt (len .Fragments.Headings) 0) -}}
{{- $tableOfContents := .Fragments.ToHTML ($toc.startLevel | int) ($toc.endLevel | int) ($toc.ordered | default false) -}}
{{- $showToc := $toc.enable | and (ne $tableOfContents `<nav id="TableOfContents"></nav>`) -}}

<aside class="aside-collection animate__animated animate__fadeIn animate__faster" aria-label="{{ T "collections" }}">
{{- /* Collection List */ -}}
Expand Down Expand Up @@ -147,7 +148,6 @@ <h1 class="single-title animate__animated animate__flipInX">

{{- /* Static TOC */ -}}
{{- if $showToc -}}
{{- $tableOfContents := .Fragments.ToHTML ($toc.startLevel | int) ($toc.endLevel | int) ($toc.ordered | default false) -}}
<div class="details toc{{ with $params.password }} encrypted-hidden{{ end }}" id="toc-static" data-kept="{{ if $toc.keepStatic }}true{{ else }}false{{ end }}">
<div class="details-summary toc-title">
<span>{{ T "single.contents" }}</span>
Expand Down

0 comments on commit b44555d

Please sign in to comment.