diff --git a/layouts/partials/header.html b/layouts/partials/header.html index 533ad0f55d..82873bc4c7 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -48,16 +48,32 @@ {{ if and (not .Params.chapter) (.Params.toc) }} {{ $first.Title }} + {{ if $page.Site.Params.createFromSiteMenusMain}} + {{ $type := .Params.menu.main.parent }} + {{ $relLink := .RelPermalink }} + {{ range $name , $value := .Site.Menus.main }} + + {{ if eq $value.Identifier $type }} + {{ if ne $relLink $value.URL }} + {{ $value.Name }} + {{ end }} + {{ end }} {{ end }} - {{ end }} - {{ end }} + + {{else}} + + {{ $type := .Type }} + {{ $relLink := .RelPermalink }} + {{ range $name , $value := .Site.Sections }} + {{ if eq $name $type }} + {{ $first := (index $value 0).Page }} + {{ if ne $first.RelPermalink $relLink }} + {{ $first.Title }} + {{ end }} + {{ end }} + {{ end }} + {{end}} + {{ with .Title }} {{ . }}{{ end }} {{ if .Params.toc }} diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index c5d4fd78e2..b07494281c 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -16,6 +16,42 @@
{{ end }} - {{ $type := .Type }} - {{ $relLink := .RelPermalink }} - {{ range $name , $value := .Site.Sections }} - {{ if eq $name $type }} - {{ $first := (index $value 0).Page }} - {{ if ne $first.RelPermalink $relLink }} -