nav: only show toc if the page has headings #182

This commit is contained in:
Sören Weber 2022-02-15 20:28:29 +01:00
parent 46328c3bc0
commit 3d6a95434c
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 3 additions and 2 deletions

View file

@ -44,7 +44,8 @@
{{- end }} {{- end }}
{{- $defaultDisableToc := .Site.Params.disableToc | default false }} {{- $defaultDisableToc := .Site.Params.disableToc | default false }}
{{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }} {{- $currentDisableToc := .Params.disableToc | default $defaultDisableToc }}
{{- $toc := (and (not $currentDisableToc) (not .Params.chapter)) }} {{- $hastoc := not (eq 0 (int (len (.TableOfContents | plainify)))) }}
{{- $toc := (and $hastoc (not $currentDisableToc) (not .Params.chapter)) }}
<div id="breadcrumbs"> <div id="breadcrumbs">
<span id="sidebar-toggle-span"> <span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" title='{{ T "Navigation-toggle" }}' data-sidebar-toggle=""> <a href="#" id="sidebar-toggle" title='{{ T "Navigation-toggle" }}' data-sidebar-toggle="">

View file

@ -57,7 +57,7 @@
{{- $themevariants := slice | append .Site.Params.themeVariant }} {{- $themevariants := slice | append .Site.Params.themeVariant }}
{{- $showthemeswitch := gt (int (len $themevariants)) 1 }} {{- $showthemeswitch := gt (int (len $themevariants)) 1 }}
{{- $footer := partial "menu-footer.html" . }} {{- $footer := partial "menu-footer.html" . }}
{{- $showfooter := not (eq 0 (int (len $footer | plainify))) }} {{- $showfooter := not (eq 0 (int (len ($footer | plainify)))) }}
{{- if or $showlangswitch $showvisitedlinks $showfooter }} {{- if or $showlangswitch $showvisitedlinks $showfooter }}
<hr class="default-animation"/> <hr class="default-animation"/>
{{- end }} {{- end }}