diff --git a/layouts/partials/header.html b/layouts/partials/header.html index af18100501..ef40e6d5e4 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -44,7 +44,8 @@ {{- end }} {{- $defaultDisableToc := .Site.Params.disableToc | default false }} {{- $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)) }}