2021-09-12 07:44:34 +00:00
|
|
|
{{- $_hugo_config := `{ "version": 1 }` }}
|
|
|
|
{{- $showhidden := .Get "showhidden"}}
|
|
|
|
{{- $style := .Get "style" | default "li" }}
|
|
|
|
{{- $depth := .Get "depth" | default 1 }}
|
|
|
|
{{- $withDescription := .Get "description" | default false }}
|
|
|
|
{{- $sortTerm := .Get "sort" | default (.Site.Params.ordersectionsby | default "weight") | lower }}
|
|
|
|
{{- $containerstyle := .Get "containerstyle" | default "ul" }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }}
|
|
|
|
{{- .Scratch.Set "pages" .Page.Pages }}
|
2019-03-12 19:30:32 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- if .Page.IsHome }}
|
2019-03-12 19:30:32 +00:00
|
|
|
<!-- Add pages that are in root dir -->
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- $rootPage := where .Page.Pages "Dir" "" }}
|
|
|
|
{{- .Scratch.Set "pages" (.Page.Sections | union $rootPage)}}
|
|
|
|
{{- else }}
|
|
|
|
{{- if .Page.Sections}}
|
|
|
|
{{- .Scratch.Set "pages" (.Page.Pages | union .Page.Sections) }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2019-05-06 17:05:39 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- $pages := (.Scratch.Get "pages") }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- if eq $sortTerm "weight" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
|
|
|
|
{{- else if or (eq $sortTerm "name") (eq $sortTerm "title") }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
|
|
|
|
{{- else if eq $sortTerm "publishdate" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
|
|
|
|
{{- else if eq $sortTerm "date" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByDate "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
|
|
|
|
{{- else if eq $sortTerm "length" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByLength "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
|
|
|
|
{{- else }}
|
|
|
|
{{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm }}
|
|
|
|
{{- end }}
|
|
|
|
{{ (printf "</%s>" $containerstyle)|safeHTML }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- define "childs" }}
|
|
|
|
{{- range .menu }}
|
|
|
|
{{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }}
|
|
|
|
{{- if not $hidden }}
|
|
|
|
{{- if not .IsHome }}
|
|
|
|
{{- if hasPrefix $.style "h" }}
|
|
|
|
{{- $num := sub ( int (trim $.style "h") ) 1 }}
|
|
|
|
{{- $numn := add $num $.count }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{ (printf "<h%d>" $numn)|safeHTML -}}
|
|
|
|
<a href="{{ .RelPermalink }}" >{{ .Title }}</a>
|
|
|
|
{{- (printf "</h%d>" $numn)|safeHTML }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- else }}
|
|
|
|
{{ (printf "<%s>" $.style)|safeHTML -}}
|
|
|
|
<a href="{{ .RelPermalink }}" >{{ .Title }}</a>
|
|
|
|
{{- (printf "</%s>" $.style)|safeHTML }}
|
|
|
|
{{- end }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- if $.description }}
|
|
|
|
{{- if .Description }}
|
|
|
|
<p>{{ .Description }}</p>
|
2019-03-12 19:30:32 +00:00
|
|
|
{{else}}
|
2021-09-12 07:44:34 +00:00
|
|
|
<p>{{ .Summary }}</p>
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if lt $.count $.depth }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- if eq $.style "li" }}
|
|
|
|
{{- (printf "<%s>" $.containerstyle)|safeHTML }}
|
|
|
|
{{- end }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- if .Sections }}
|
|
|
|
{{- .Scratch.Set "pages" (.Pages | union .Sections) }}
|
|
|
|
{{- else }}
|
|
|
|
{{- .Scratch.Set "pages" .Pages }}
|
|
|
|
{{- end }}
|
2019-05-06 17:05:39 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- $pages := (.Scratch.Get "pages") }}
|
2019-03-12 19:30:32 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- if eq $.sortTerm "weight" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByWeight "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
|
|
|
|
{{- else if or (eq $.sortTerm "name") (eq $.sortTerm "title") }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByTitle "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
|
|
|
|
{{- else if eq $.sortTerm "publishdate" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByPublishDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
|
|
|
|
{{- else if eq $.sortTerm "date" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByDate "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
|
|
|
|
{{- else if eq $.sortTerm "length" }}
|
|
|
|
{{- template "childs" dict "menu" $pages.ByLength "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
|
|
|
|
{{- else }}
|
|
|
|
{{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm }}
|
|
|
|
{{- end }}
|
2017-08-01 20:37:40 +00:00
|
|
|
|
2021-09-12 07:44:34 +00:00
|
|
|
{{- if eq $.style "li" }}
|
|
|
|
{{- (printf "</%s>" $.containerstyle)|safeHTML }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|