diff --git a/layouts/_default/list.html b/layouts/_default/list.html index e69de29bb2..16f6ffc141 100644 --- a/layouts/_default/list.html +++ b/layouts/_default/list.html @@ -0,0 +1,3 @@ +{{ partial "header.html" . }} +{{ .Content }} +{{ partial "footer.html" . }} diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index db86a98737..86cf6c7695 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -1,5 +1,5 @@ - {{ if .Params.chapter }} + {{ if eq .Kind "section" }} {{ end }} diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 030139c576..12ee292785 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -47,7 +47,7 @@ - {{ if and (not .Params.chapter) (.Params.toc) }} + {{ if and (ne .Kind "section") (.Params.toc) }} {{ end }} {{ $type := .Type }} @@ -67,10 +67,10 @@ {{ end }} - {{ if .Params.chapter }} + {{ if eq .Kind "section" }}
{{ end }} -
- {{ if not .Params.chapter }} +
+ {{ if ne .Kind "section" }}

{{.Title}}

{{ end }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index 5d344a4735..7956836817 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -12,31 +12,27 @@
    {{ $page := . }} - {{ if .Site.Params.menu }} - {{ $.Scratch.Set "menuItems" (slice) }} - {{ range $i, $key := .Site.Params.menu }} - {{ if isset $page.Site.Sections $key }} - {{ $.Scratch.Add "menuItems" $key }} - {{ else }} -
  • - {{ printf "Unknown section '%s' found in site menu" $key }} -

  • - {{ end }} - {{ end }} - {{ else }} - {{ $.Scratch.Set "menuItems" .Site.Sections }} + {{ $.Scratch.Set "_pages" (slice) }} + {{ range $key, $value := .Site.Sections }} + {{ $.Scratch.Add "_pages" ($.Site.GetPage "section" $key) }} + {{ end }} + {{ $.Scratch.Set "menuItems" (slice)}} + {{ range $key, $value := sort ($.Scratch.Get "_pages") "Weight" }} + {{ $.Scratch.Add "menuItems" $value.Section }} {{ end }} {{ $menuItems := $.Scratch.Get "menuItems" }} {{ range $i, $key := $menuItems }} {{ if ne $key "" }} - {{ if not $.Site.Params.menu }} - {{ $.Scratch.Set "currentItem" (index $page.Site.Sections $i) }} - {{ else }} - {{ $.Scratch.Set "currentItem" (index $page.Site.Sections $key) }} + {{ $value := (index $page.Site.Sections $key) }} + {{ with $index := $.Site.GetPage "section" $key }} + {{ if .Title }} + {{ $.Scratch.Set "first" $index }} + {{ else }} + {{ $.Scratch.Set (index $value 0).Page }} + {{ end }} {{ end }} - {{ $value := $.Scratch.Get "currentItem" }} - {{ $first := (index $value 0).Page }} + {{ $first := $.Scratch.Get "first" }}