diff --git a/layouts/_default/list.html b/layouts/_default/list.html index 8d1fdab11d..c536b82900 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -1,10 +1,13 @@ -{{ partial "header.html" . }} {{ if .Content }} +{{ partial "header.html" . }} {{ .Content }} -{{ else }} -{{ with (index (index .Site.Sections .Section) 0) }} -{{ .Page.Content }} -{{ $.Scratch.Set "uniqueId" .Page.UniqueID }} -{{ end }} -{{ end }} {{ partial "footer.html" . }} +{{ else }} +{{ with (index (index .Site.Sections .Section) 0) }} +{{ with .Page }} +{{ partial "header.html" . }} +{{ .Content }} +{{ partial "footer.html" . }} +{{ end }} +{{ end }} +{{ end }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 8e84557123..2c75ee3897 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,5 +1,5 @@ - {{ $isChapter := or (eq .Kind "section") (.Params.chapter)}} + {{ $isChapter := .Params.chapter | default (eq .Kind "section")}} {{ if $isChapter }} {{ end }} @@ -33,8 +33,7 @@ {{ if $.Site.Params.autoNav }} {{ $allpages := $.Scratch.Get "_allpages" }} {{ range $index, $element := $allpages }} - {{ $uniqueid := ($.Scratch.Get "uniqueId" | default $.UniqueID ) }} - {{if eq $element.UniqueID $uniqueid }} + {{if eq $element.UniqueID $.UniqueID }} {{ if not (isset $.Params "prev") }} {{ with index $allpages (sub $index 1) }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index c61851a5fe..a9882a9cb7 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -22,7 +22,7 @@ {{ partial "style.html" . }} - {{ $isChapter := or (eq .Kind "section") (.Params.chapter)}} + {{ $isChapter := .Params.chapter | default (eq .Kind "section")}} {{ partial "menu.html" . }}
@@ -51,14 +51,17 @@ {{ if and (not $isChapter) (.Params.toc) }} {{ end }} - {{ $type := .Type }} - {{ $relLink := .RelPermalink }} - {{ range $name , $value := .Site.Sections }} - {{ if eq $name $type }} - {{ $first := (index $value 0).Page }} - {{ if ne $first.RelPermalink $relLink }} - - {{ 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 }} + {{ end }} {{ end }} {{ with .Title }} {{ . }}{{ end }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 67d72026e9..8e60b3b658 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -11,13 +11,17 @@