diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a9882a9cb7..26ce94f20c 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -51,17 +51,19 @@ {{ if and (not $isChapter) (.Params.toc) }} {{ end }} - {{ $section := index .Site.Sections .Section }} - {{ $sectionPage := $.Site.GetPage "section" $.Section }} - {{ if $sectionPage.Content }} - {{ $first := $.Site.GetPage "section" $.Section }} - {{ if ne $first.UniqueID $.UniqueID }} - - {{ end }} - {{ else if gt $section.Len 0 }} - {{ $first := (index $section 0).Page }} - {{ if ne $first.UniqueID $.UniqueID }} - + {{ if ne $.Section "" }} + {{ $section := index $.Site.Sections $.Section }} + {{ $sectionPage := $.Site.GetPage "section" $.Section }} + {{ if $sectionPage.Content }} + {{ $first := $.Site.GetPage "section" $.Section }} + {{ if ne $first.UniqueID $.UniqueID }} + + {{ end }} + {{ else if gt $section.Len 0 }} + {{ $first := (index $section 0).Page }} + {{ if ne $first.UniqueID $.UniqueID }} + + {{ end }} {{ end }} {{ end }} {{ with .Title }} {{ . }}{{ end }}