{{ $_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 "Weight" }} {{ $containerstyle := .Get "containerstyle" | default "ul" }} {{(printf "<%s class=\"children children-%s\">" $containerstyle $style)|safeHTML}} {{ .Scratch.Set "pages" .Page.Pages }} {{if .Page.IsHome}} {{ $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}} {{ $pages := (.Scratch.Get "pages") }} {{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 eq $sortTerm "Name"}} {{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 "" $containerstyle)|safeHTML}} {{ 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 }} {{(printf "" $numn)|safeHTML}} {{ .Title }} {{(printf "" $numn)|safeHTML}} {{else}} {{(printf "<%s>" $.style)|safeHTML}} {{ .Title }} {{(printf "" $.style)|safeHTML}} {{end}} {{if $.description}} {{if .Description}}

{{.Description}}

{{else}}

{{.Summary}}

{{end}} {{end}} {{end}} {{ if lt $.count $.depth}} {{if eq $.style "li"}} {{(printf "<%s>" $.containerstyle)|safeHTML}} {{end}} {{ if .Sections}} {{ .Scratch.Set "pages" (.Pages | union .Sections) }} {{else}} {{ .Scratch.Set "pages" .Pages }} {{end}} {{ $pages := (.Scratch.Get "pages") }} {{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 eq $.sortTerm "Name"}} {{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}} {{if eq $.style "li"}} {{(printf "" $.containerstyle)|safeHTML}} {{end}} {{end}} {{end}} {{end}} {{end}}