mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-05 06:13:14 +00:00
feat(authors): preserve entered casing and links for author names
- keep raw front-matter author strings as preferred display when no profile exists - fall back to title-cased humanized slug only as last resort to avoid lowercase initials - render authors directly from Params order and resolve links via taxonomy pages when present Fix https://discord.com/channels/722225264733716590/1457522006462435541/1458539152160067784
This commit is contained in:
1 parent
62b8f3f8f6
commit
ae338f0ba0
1 file changed
+14
-7
@@ -1,16 +1,23 @@
|
||||
{{/* Display author list. */}}
|
||||
|
||||
{{ if .Params.authors }}
|
||||
{{ range $index, $term := (.GetTerms "authors") }}
|
||||
{{- $slug := $term.Data.Term | urlize -}}
|
||||
{{- $profile := partial "functions/get_author_profile" (dict "slug" $slug) -}}
|
||||
{{- $display := $profile.title | default $term.LinkTitle -}}
|
||||
{{- $authors := .Params.authors -}}
|
||||
|
||||
{{ if $authors }}
|
||||
{{- if not (reflect.IsSlice $authors) -}}
|
||||
{{- $authors = slice $authors -}}
|
||||
{{- end -}}
|
||||
|
||||
{{ range $index, $raw := $authors }}
|
||||
{{- $slug := $raw | urlize -}}
|
||||
{{- $profile := partial "functions/get_author_profile" (dict "slug" $slug "title" $raw) -}}
|
||||
{{- $termPage := site.GetPage (printf "/authors/%s" $slug) -}}
|
||||
{{- $display := $profile.title | default $raw -}}
|
||||
{{- $highlight_name := false -}}
|
||||
|
||||
{{- if gt $index 0 }}, {{ end -}}
|
||||
<span {{ if $highlight_name }}class="font-bold"{{end}}>
|
||||
{{- if $term.RelPermalink -}}
|
||||
<a href="{{ $term.RelPermalink }}">{{ $display }}</a>
|
||||
{{- if $termPage -}}
|
||||
<a href="{{ $termPage.RelPermalink }}">{{ $display }}</a>
|
||||
{{- else -}}
|
||||
{{ $display }}
|
||||
{{- end -}}
|
||||
|
||||
Reference in new issue
Block a user