mirror of
https://github.com/tiennm99/HugoBlox-kit.git
synced 2026-10-05 06:13:14 +00:00
feat(authors): preserve author casing when profiles are missing
- retain raw front-matter author strings as display names when no profile data is present - title-case humanized slug only as last-resort fallback to avoid lowercase surnames - reduce need for author profile files while keeping names correctly capitalized Fixes https://discord.com/channels/722225264733716590/1457522006462435541
This commit is contained in:
1 parent
bfdcb6603c
commit
85307a8097
1 file changed
+8
-1
@@ -20,17 +20,22 @@ Output (dict):
|
||||
|
||||
{{- $input := . -}}
|
||||
{{- $slug := "" -}}
|
||||
{{- $rawTitle := "" -}}
|
||||
|
||||
{{- $inputType := printf "%T" $input -}}
|
||||
|
||||
{{- if (reflect.IsMap $input) -}}
|
||||
{{- $slug = index $input "slug" | default "" -}}
|
||||
{{- with index $input "title" }}{{ $rawTitle = . }}{{ end -}}
|
||||
{{- else if eq $inputType "string" -}}
|
||||
{{- $slug = $input -}}
|
||||
{{- $rawTitle = $input -}}
|
||||
{{- else -}}
|
||||
{{- $slug = printf "%v" $input -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $rawTitle = trim $rawTitle " " -}}
|
||||
|
||||
{{- $slug = $slug | urlize -}}
|
||||
|
||||
{{- $data := index site.Data.authors $slug -}}
|
||||
@@ -59,8 +64,10 @@ Output (dict):
|
||||
{{- $title = $display -}}
|
||||
{{- else if $data.title -}}
|
||||
{{- $title = $data.title -}}
|
||||
{{- else if $rawTitle -}}
|
||||
{{- $title = $rawTitle -}}
|
||||
{{- else -}}
|
||||
{{- $title = $slug | humanize -}}
|
||||
{{- $title = $slug | humanize | title -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $role := $data.role -}}
|
||||
|
||||
Reference in new issue
Block a user