Change inline page authors from strings to maps

master
Will Faught 3 years ago
parent 887be3eb42
commit 522328aaad

@ -249,8 +249,9 @@ Optional page parameters:
```yaml ```yaml
authors: [ authors: [
"Michael Bluth", # Credit this name exactly "michael_bluth", # Credit the corresponding author name in the site parameters
"george_bluth" # Credit the corresponding author name in the site parameters {"author": "michael_bluth"}, # Credit the corresponding author name in the site parameters
{"name": "Lucille Bluth"} # Credit this author name
] ]
link: "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title link: "https://youtu.be/dQw4w9WgXcQ" # The reference for an anchor around the title
paige: paige:

@ -2,7 +2,15 @@
{{ if .Params.authors }} {{ if .Params.authors }}
{{ $names := slice }} {{ $names := slice }}
{{ range .Params.authors }} {{ range .Params.authors }}
{{ $names = $names | append (index site.Params.authors . "name" | default .) }} {{ if eq (printf "%T" .) "string" }}
{{ $names = $names | append (index site.Params.authors .).name }}
{{ else }}
{{ with .author }}
{{ $names = $names | append (index site.Params.authors .).name }}
{{ else }}
{{ $names = $names | append .name }}
{{ end }}
{{ end }}
{{ end }} {{ end }}
{{ $result = delimit $names ", " }} {{ $result = delimit $names ", " }}
{{ else if .Site.Params.authors }} {{ else if .Site.Params.authors }}

Loading…
Cancel
Save