mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-27 01:33:04 +00:00
taxonomy: simplify code #852
This commit is contained in:
parent
ff35016bca
commit
21b4289ecf
1 changed files with 2 additions and 21 deletions
|
@ -14,28 +14,9 @@
|
||||||
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
{{- $icon = printf "fa-fw fas fa-%s" $icon }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $taxonomy_page := $page.Site.GetPage $taxonomy }}
|
{{- $taxonomy_page := $page.Site.GetPage $taxonomy }}
|
||||||
{{- $terms := slice | append (index $page.Params $taxonomy) }}
|
|
||||||
{{- $term_pages := slice }}
|
{{- $term_pages := slice }}
|
||||||
{{- range $terms }}
|
{{- range $page.GetTerms $taxonomy }}
|
||||||
{{- $term := . }}
|
|
||||||
{{- $term_key := $term }}
|
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
|
||||||
{{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
|
{{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
|
||||||
{{- else }}
|
|
||||||
{{- $term = trim $term " " }}
|
|
||||||
{{- if not $term }}
|
|
||||||
{{- continue }}
|
|
||||||
{{- end }}
|
|
||||||
{{- $term_key = ($term | plainify | anchorize) }}
|
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
|
||||||
{{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
|
|
||||||
{{- else }}
|
|
||||||
{{- $term_key = ($term | urlize) }}
|
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
|
||||||
{{- $term_pages = $term_pages | append (dict "Title" (partial "pageHelper/title.hugo" (dict "page" . "linkTitle" true "format" $format "outputFormat" $outputFormat)) "Term" . )}}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $taxonomy_title := partial "pageHelper/title.hugo" (dict "page" $taxonomy_page "format" $format "outputFormat" $outputFormat) }}
|
{{- $taxonomy_title := partial "pageHelper/title.hugo" (dict "page" $taxonomy_page "format" $format "outputFormat" $outputFormat) }}
|
||||||
{{- with $term_pages }}
|
{{- with $term_pages }}
|
||||||
|
|
Loading…
Reference in a new issue