github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/shortcodes/children.html (about) 1 {{- $page := .page }} 2 {{- if and (not $page) .context }} 3 {{- $page = .context }} 4 {{- warnf "%q: DEPRECATED parameter 'context' for shortcode 'children' found, use 'page' instead; see https://mcshelby.github.io/hugo-theme-relearn/basics/migration#5180" $page.File.Filename }} 5 {{- end }} 6 {{- $showhidden := .showhidden | default false }} 7 {{- if eq (printf "%T" $showhidden) "string" }} 8 {{- $showhidden = (eq $showhidden "true") }} 9 {{- end }} 10 {{- $style := .style | default "li" }} 11 {{- $depth := .depth | default 1 }} 12 {{- $withDescription := .description | default false }} 13 {{- if eq (printf "%T" $withDescription) "string" }} 14 {{- $withDescription = (eq $withDescription "true") }} 15 {{- end }} 16 {{- $sortTerm := .sort | lower }} 17 {{- $containerstyle := .containerstyle | default "ul" }} 18 {{- if( and (not (eq $style "li") ) (eq $containerstyle "ul" ) ) }} 19 {{- $containerstyle = "div" }} 20 {{- end }} 21 22 {{- with $page }} 23 {{ (printf "<%s class=\"children children-%s children-sort-%s\">" $containerstyle $style $sortTerm)|safeHTML }} 24 {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }} 25 {{- template "childs" dict "menu" $pages "containerstyle" $containerstyle "style" $style "showhidden" $showhidden "count" 1 "depth" $depth "pages" .Site.Pages "description" $withDescription "sortTerm" $sortTerm "page" . }} 26 {{ (printf "</%s>" $containerstyle)|safeHTML }} 27 {{- end }} 28 29 {{- define "childs" }} 30 {{ $page := .page }} 31 {{- range .menu }} 32 {{- $hidden := and (or (.Params.hidden) (eq .Title "")) (not $.showhidden) }} 33 {{- if not $hidden }} 34 {{- if not .IsHome }} 35 {{- if hasPrefix $.style "h" }} 36 {{- $num := sub ( int (trim $.style "h") ) 1 }} 37 {{- $numn := add $num $.count }} 38 {{ (printf "<h%d>" $numn)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</h%d>" $numn)|safeHTML }} 39 {{- if $.description }} 40 {{- if .Description -}} 41 <p>{{ .Description }}</p> 42 {{- else -}} 43 <p>{{ .Summary }}</p> 44 {{- end }} 45 {{- end }} 46 47 {{- else if eq $.style "li" }} 48 {{ (printf "<%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }} 49 {{- if $.description }} 50 {{- if .Description -}} 51 <p>{{ .Description }}</p> 52 {{- else -}} 53 <p>{{ .Summary }}</p> 54 {{- end }} 55 {{- end }} 56 57 {{- else }} 58 {{ (printf "<%s>" $.style)|safeHTML }}{{ if .RelPermalink }}<a href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" .) }}">{{ .Title }}</a>{{ else }}<span>{{ .Title }}</span>{{ end }}{{ (printf "</%s>" $.style)|safeHTML }} 59 {{- if $.description }} 60 {{- if .Description -}} 61 <p>{{ .Description }}</p> 62 {{- else -}} 63 <p>{{ .Summary }}</p> 64 {{- end }} 65 {{- end }} 66 67 {{- end }} 68 {{- end }} 69 {{- if lt $.count $.depth }} 70 71 {{- if eq $.style "li" }} 72 {{- (printf "<%s>" $.containerstyle)|safeHTML }} 73 {{- end }} 74 75 {{- $pages := partial "pageHelper/pagesBy.html" (dict "page" . "hidden" true) }} 76 {{- template "childs" dict "menu" $pages "containerstyle" $.containerstyle "style" $.style "showhidden" $.showhidden "count" (add $.count 1) "depth" $.depth "pages" $.pages "description" $.description "sortTerm" $.sortTerm "page" $page }} 77 78 {{- if eq $.style "li" }} 79 {{- (printf "</%s>" $.containerstyle)|safeHTML }} 80 {{- end }} 81 {{- end }} 82 83 {{- if not .IsHome }} 84 {{- if eq $.style "li" }} 85 {{- (printf "</%s>" $.style)|safeHTML -}} 86 {{- end }} 87 {{- end }} 88 {{- end }} 89 {{- end }} 90 {{- end }}