diff --git a/layouts/partials/menu.html b/layouts/partials/menu.html index fb82d3e123..539a6a428e 100644 --- a/layouts/partials/menu.html +++ b/layouts/partials/menu.html @@ -1,7 +1,6 @@ - -{{ $currentNode := . }} -{{ $showvisitedlinks := .Site.Params.showVisitedLinks }} + {{ $currentNode := . }} + {{ $showvisitedlinks := .Site.Params.showVisitedLinks }} {{ partial "logo.html" . }} @@ -20,18 +19,17 @@ {{end}} - + - - {{if eq .Site.Params.ordersectionsby "title"}} - {{range .Site.Home.Sections.ByTitle}} - {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}} - {{end}} - {{else}} - {{range .Site.Home.Sections.ByWeight}} - {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}} - {{end}} + {{if eq .Site.Params.ordersectionsby "title"}} + {{range .Site.Home.Sections.ByTitle}} + {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}} {{end}} + {{else}} + {{range .Site.Home.Sections.ByWeight}} + {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks}} + {{end}} + {{end}} {{ $disableShortcutsTitle := .Site.Params.DisableShortcutsTitle}} @@ -40,58 +38,58 @@ {{ if not $disableShortcutsTitle}}{{ T "Shortcuts-Title"}}{{ end }} {{ range sort . "Weight"}} - - {{.Pre}}{{safeHTML .Name}}{{.Post}} - + + {{.Pre}}{{safeHTML .Name}}{{.Post}} + {{end}} {{end}} {{ if or .Site.IsMultiLingual $showvisitedlinks }} - - - - {{ if and .Site.IsMultiLingual (not .Site.Params.DisableLanguageSwitchingButton)}} - - - - - - {{ $siteLanguages := .Site.Languages}} - {{ $pageLang := .Page.Lang}} - {{ range .Page.AllTranslations }} - {{ $translation := .}} - {{ range $siteLanguages }} - {{ if eq $translation.Lang .Lang }} - {{ $selected := false }} - {{ if eq $pageLang .Lang}} - {{ .LanguageName }} - {{ else }} - {{ .LanguageName }} + + + + {{ if and .Site.IsMultiLingual (not .Site.Params.DisableLanguageSwitchingButton)}} + + + + + + {{ $siteLanguages := .Site.Languages}} + {{ $pageLang := .Page.Lang}} + {{ range .Page.AllTranslations }} + {{ $translation := .}} + {{ range $siteLanguages }} + {{ if eq $translation.Lang .Lang }} + {{ $selected := false }} + {{ if eq $pageLang .Lang}} + {{ .LanguageName }} + {{ else }} + {{ .LanguageName }} + {{ end }} + {{ end }} + {{ end }} {{ end }} - {{ end }} - {{ end }} - {{ end }} - - - - - - - - - - - - {{end}} + + + + + + + + + + + + {{end}} - {{ if $showvisitedlinks}} - {{T "Clear-History"}} - {{ end }} - - + {{ if $showvisitedlinks}} + {{T "Clear-History"}} + {{ end }} + + {{ end }} {{ partial "menu-footer.html" . }} @@ -105,56 +103,54 @@ {{ $currentNode := .currentnode }} {{ $currentFileUniqueID := "" }} {{ with $currentNode.File }}{{ $currentFileUniqueID = .UniqueID }}{{ end }} - {{with .sect}} - {{if and .IsSection (or (not .Params.hidden) $.showhidden)}} - {{safeHTML .Params.head}} - - + {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} {{ if $showvisitedlinks}} {{ end }} - - {{ $numberOfPages := (add (len ( where .Pages "Params.hidden" "ne" true )) (len ( where .Sections "Params.hidden" "ne" true ))) }} - {{ if ne $numberOfPages 0 }} - - {{ $currentNode.Scratch.Set "pages" .Pages }} - {{ if .Sections}} - {{ $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }} - {{end}} - {{ $pages := ($currentNode.Scratch.Get "pages") }} + + {{ $numberOfPages := (add (len ( where .Pages "Params.hidden" "ne" true )) (len ( where .Sections "Params.hidden" "ne" true ))) }} + {{ if ne $numberOfPages 0 }} + + {{ $currentNode.Scratch.Set "pages" .Pages }} + {{ if .Sections}} + {{ $currentNode.Scratch.Set "pages" (.Pages | union .Sections) }} + {{end}} + {{ $pages := ($currentNode.Scratch.Get "pages") }} - {{if eq .Site.Params.ordersectionsby "title"}} - {{ range $pages.ByTitle }} - {{ if and .Params.hidden (not $.showhidden) }} + {{if eq .Site.Params.ordersectionsby "title"}} + {{ range $pages.ByTitle }} + {{ if and .Params.hidden (not $.showhidden) }} + {{else}} + {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }} + {{end}} + {{ end }} {{else}} - {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }} + {{ range $pages.ByWeight }} + {{ if and .Params.hidden (not $.showhidden) }} + {{else}} + {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }} + {{end}} + {{ end }} {{end}} - {{ end }} - {{else}} - {{ range $pages.ByWeight }} - {{ if and .Params.hidden (not $.showhidden) }} - {{else}} - {{ template "section-tree-nav" dict "sect" . "currentnode" $currentNode "showvisitedlinks" $showvisitedlinks }} - {{end}} - {{ end }} - {{end}} - - {{ end }} - - {{else}} - {{ if not .Params.Hidden }} + + {{ end }} + + {{else if not .Params.Hidden }} {{safeHTML .Params.Pre}}{{or .Params.menuTitle .LinkTitle .Title}}{{safeHTML .Params.Post}} {{ if $showvisitedlinks}}{{end}} - - {{ end }} - {{end}} - {{ end }} + + {{end}} + {{ end }} {{ end }}