fix: workaround Hugo Page.GetTerms bug

Hugo bug causes authors not to be listed in the order in which they were defined in the front matter.

See Hugo bug report at https://github.com/gohugoio/hugo/issues/7213

This commit partially reverts f78feefee9 where the code was refactored to use Page.GetTerms for authors.
This commit is contained in:
George Cushen committed 2020-05-01 00:03:57 +01:00
1 parent f78feefee9
commit 48b39f8550
1 file changed
+6 -7
+6 -7
View File
@@ -1,18 +1,17 @@
{{/* Display author list. */}}
{{- $taxonomy := "authors" }}
{{ if .Param $taxonomy }}
{{ with .Param $taxonomy }}
{{ $link_authors := site.Params.link_authors | default true }}
{{ range $index, $value := (.GetTerms $taxonomy) }}
{{- /* Check if a profile was created for this user. */ -}}
{{- $profile_page := isset .Page.Params "superuser" -}}
{{ range $index, $name_raw := . }}
{{- $profile_page := site.GetPage (printf "/%s/%s" $taxonomy .) -}}
{{- $name := $profile_page.Title | default $name_raw -}}
{{- if gt $index 0 }}, {{ end -}}
<span>
{{- if and $profile_page $link_authors -}}
<a href="{{.RelPermalink}}">{{ .LinkTitle }}</a>
<a href="{{$profile_page.RelPermalink}}">{{$name}}</a>
{{- else -}}
{{ .LinkTitle }}
{{$name}}
{{- end -}}
</span>
{{- end -}}