mirror of
https://github.com/McShelby/hugo-theme-relearn
synced 2025-05-01 00:27:48 +08:00
theme: compatiblity for taxonomy term lists with Hugo 0.123 #771
This commit is contained in:
parent
4bc5529bc8
commit
5fb02b2dd7
@ -15,11 +15,16 @@
|
|||||||
{{- $terms := slice | append (index $page.Params $taxonomy) }}
|
{{- $terms := slice | append (index $page.Params $taxonomy) }}
|
||||||
{{- $term_pages := slice }}
|
{{- $term_pages := slice }}
|
||||||
{{- range $terms }}
|
{{- range $terms }}
|
||||||
{{- $term := trim . " " }}
|
{{- $term := . }}
|
||||||
|
{{- $term_key := $term }}
|
||||||
|
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
||||||
|
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}}
|
||||||
|
{{- else }}
|
||||||
|
{{- $term = trim $term " " }}
|
||||||
{{- if not $term }}
|
{{- if not $term }}
|
||||||
{{- continue }}
|
{{- continue }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $term_key := ($term | plainify | anchorize) }}
|
{{- $term_key = ($term | plainify | anchorize) }}
|
||||||
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
{{- with $page.Site.GetPage (printf "%s/%s" $taxonomy $term_key) }}
|
||||||
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}}
|
{{- $term_pages = $term_pages | append (dict "Title" (default (humanize .Data.Term | strings.Title) .Title) "Term" . )}}
|
||||||
{{- else }}
|
{{- else }}
|
||||||
@ -29,6 +34,7 @@
|
|||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- $taxonomy_title := default (default $taxonomy_page.Data.Plural (i18n $taxonomy_page.Data.Plural)) $taxonomy_page.Title }}
|
{{- $taxonomy_title := default (default $taxonomy_page.Data.Plural (i18n $taxonomy_page.Data.Plural)) $taxonomy_page.Title }}
|
||||||
{{- with $term_pages }}
|
{{- with $term_pages }}
|
||||||
<div class=" taxonomy-{{ $taxonomy }} term-list cstyle {{ $style }} {{ $class }}" title="{{ $taxonomy_title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}>
|
<div class=" taxonomy-{{ $taxonomy }} term-list cstyle {{ $style }} {{ $class }}" title="{{ $taxonomy_title }}"{{ if $color }}{{ printf " style=\"--VARIABLE-TAGS-BG-color: %s;\"" $color | safeHTMLAttr }}{{ end }}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user