Skip to content

Commit

Permalink
Display non-empty page TOC (google#1147)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored and fekete-robert committed Sep 13, 2022
1 parent 089b3c0 commit 509dafb
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions layouts/partials/toc.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
{{ if not .Params.notoc }}
{{ with .TableOfContents }}
{{ if ge (len .) 200 }}
<div class="td-toc">{{ . }}</div>
{{ end }}
{{ end }}
{{ end }}
{{ if not .Params.notoc -}}
{{ with .TableOfContents -}}
{{ if ne . `<nav id="TableOfContents"></nav>` -}}
<div class="td-toc">
{{ . }}
</div>
{{ end -}}
{{ end -}}
{{ end -}}

0 comments on commit 509dafb

Please sign in to comment.