59 lines
2.1 KiB
HTML
59 lines
2.1 KiB
HTML
{{$currentNode := .}}
|
|
<nav class="open-menu">
|
|
<ul>
|
|
<li class="{{ if .IsHome }}active{{ end }}"><a href="{{ .Site.BaseURL }}">Home</a></li>
|
|
{{- if eq .Site.Params.ordersectionsby "title" -}}
|
|
{{- range .Site.Home.Sections.ByTitle -}}
|
|
{{template "open-menu" dict "sect" . "currentnode" $currentNode}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- range .Site.Home.Sections.ByWeight -}}
|
|
{{template "open-menu" dict "sect" . "currentnode" $currentNode}}
|
|
{{- end -}}
|
|
{{- end}}
|
|
</ul>
|
|
</nav>
|
|
|
|
{{define "open-menu"}}
|
|
{{- $currentNode := .currentnode -}}
|
|
{{ with .sect }}
|
|
{{ if .IsSection }}
|
|
{{ if in .Site.Params.menu_exclusion .Section }}
|
|
{{- else -}}
|
|
{{- safeHTML .Params.head -}}
|
|
{{- $numberOfPages := (add (len .Pages) (len .Sections)) -}}
|
|
<li class="{{ if .IsAncestor $currentNode }}parent{{ end }}{{ if and .File $currentNode.File }}{{ if eq .File.UniqueID $currentNode.File.UniqueID }} active{{ end }}{{ end }}{{ if .Params.alwaysopen }} parent{{ end }}"><a href="{{ .Permalink }}">{{ safeHTML .Params.Pre }}{{ .Title }}{{ safeHTML .Params.Post }}</a>
|
|
{{ if ne $numberOfPages 0 }}
|
|
<ul class="sub-menu">
|
|
{{- .Scratch.Set "pages" .Pages -}}
|
|
{{- if .Sections -}}
|
|
{{- .Scratch.Set "pages" (.Pages | union .Sections) -}}
|
|
{{- end -}}
|
|
{{- $pages := (.Scratch.Get "pages") -}}
|
|
{{- if eq .Site.Params.ordersectionsby "title" -}}
|
|
{{- range $pages.ByTitle -}}
|
|
{{- if and .Params.hidden (not $.showhidden) -}}
|
|
{{- else -}}
|
|
{{template "open-menu" dict "sect" . "currentnode" $currentNode}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- range $pages.ByWeight -}}
|
|
{{- if and .Params.hidden (not $.showhidden) -}}
|
|
{{- else -}}
|
|
{{template "open-menu" dict "sect" . "currentnode" $currentNode}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end}}
|
|
</ul>
|
|
{{end}}
|
|
</li>
|
|
{{- end -}}
|
|
{{- else -}}
|
|
{{- if not .Params.Hidden -}}
|
|
<li class="{{ if and .File $currentNode.File }}{{ if eq .File.UniqueID $currentNode.File.UniqueID }}active{{ end }}{{ end }}"><a href="{{ .Permalink }}">{{ safeHTML .Params.Pre }}{{ .Title }}{{ safeHTML .Params.Post }}</a></li>
|
|
{{- end -}}
|
|
{{ end -}}
|
|
{{ end -}}
|
|
{{ end }}
|