github.com/choria-io/go-choria@v0.28.1-0.20240416190746-b3bf9c7d5a45/docs/themes/hugo-theme-relearn/layouts/partials/term-list.html (about) 1 {{- $page := .page }} 2 {{- $taxonomy := .taxonomy }} 3 {{- $class := .class }} 4 {{- $color := .color | default "" }} 5 {{- $style := .style | default "" }} 6 {{- if and (not $style) (eq (len $style) 0) }} 7 {{- $color = .color | default "var(--INTERNAL-TAG-BG-color)" }} 8 {{- end }} 9 {{- $icon := .icon | default "" }} 10 {{- $icon = trim $icon " " }} 11 {{- if and $icon (not (findRE ".*?\\bfa-\\w.*?" $icon)) }} 12 {{- $icon = printf "fa-fw fas fa-%s" $icon }} 13 {{- end }} 14 {{- $taxonomy_page := $page.Site.GetPage $taxonomy }} 15 {{- $terms := slice | append (index $page.Params $taxonomy) }} 16 {{- $term_pages := slice }} 17 {{- range $terms }} 18 {{- $term := . }} 19 {{- $term_key := $term }} 20 {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} 21 {{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} 22 {{- else }} 23 {{- $term = trim $term " " }} 24 {{- if not $term }} 25 {{- continue }} 26 {{- end }} 27 {{- $term_key = ($term | plainify | anchorize) }} 28 {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} 29 {{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} 30 {{- else }} 31 {{- $term_key = ($term | urlize) }} 32 {{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }} 33 {{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}} 34 {{- end }} 35 {{- end }} 36 {{- end }} 37 {{- end }} 38 {{- $taxonomy_title := default (default $taxonomy_page.Data.Plural (i18n $taxonomy_page.Data.Plural)) $taxonomy_page.Params.Title }} 39 {{- with $term_pages }} 40 <div class=" taxonomy-{{ $taxonomy }} term-list cstyle {{ $style }} {{ $class }}" title="{{ $taxonomy_title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}> 41 {{- if $icon }} 42 <i class="{{ $icon }}"></i> 43 {{- end }} 44 <ul> 45 {{- range sort . ".Title" }} 46 {{- $to := .Term }} 47 <li><a class="term-link" href="{{ partial "relLangPrettyUglyURL.hugo" (dict "to" $to) }}">{{ .Title }}</a></li> 48 {{- end }} 49 </ul> 50 </div> 51 {{- end }}