From 522328aaad6c0320f543f4de3795a204db126387 Mon Sep 17 00:00:00 2001 From: Will Faught Date: Fri, 30 Dec 2022 00:03:30 -0800 Subject: [PATCH] Change inline page authors from strings to maps --- README.md | 5 +++-- layouts/partials/paige/func-authors.html | 10 +++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 81fcd222..818ec1c2 100644 --- a/README.md +++ b/README.md @@ -249,8 +249,9 @@ Optional page parameters: ```yaml authors: [ - "Michael Bluth", # Credit this name exactly - "george_bluth" # Credit the corresponding author name in the site parameters + "michael_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 paige: diff --git a/layouts/partials/paige/func-authors.html b/layouts/partials/paige/func-authors.html index 2febab76..3983f70c 100644 --- a/layouts/partials/paige/func-authors.html +++ b/layouts/partials/paige/func-authors.html @@ -2,7 +2,15 @@ {{ if .Params.authors }} {{ $names := slice }} {{ 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 }} {{ $result = delimit $names ", " }} {{ else if .Site.Params.authors }}