diff --git a/layouts/partials/page_author.html b/layouts/partials/page_author.html index a93b54f5..56fbea9e 100644 --- a/layouts/partials/page_author.html +++ b/layouts/partials/page_author.html @@ -9,39 +9,12 @@ {{ $author_urlized := "" }} {{ if and (not .Params.authors) (.Scratch.Get "superuser_username") }} {{ $author_urlized = (.Scratch.Get "superuser_username") }} -{{ else }} - {{ $first_author := "" }} - {{ if .Params.authors }} - {{ $first_author = index .Params.authors 0 }} + {{ partial "page_author_card" (dict "username" $author_urlized) }} +{{ else if .Params.authors }} + {{ range $key, $tmp_username := .Params.authors }} + {{ $author_urlized = urlize $tmp_username }} + {{ partial "page_author_card" (dict "username" $author_urlized) }} {{ end }} - {{ $author_urlized = urlize $first_author }} {{ end }} -{{ $site_type := site.Params.site_type | default "Person" }} -{{ $taxonomy := "authors" }} -{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }} -{{ with $profile_page }} - {{/* If it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}} - {{ $profile_url := .RelPermalink }} - {{ if and (eq $site_type "Person") (eq .Params.superuser true) }} - {{ $profile_url = site.BaseURL }} - {{ end }} - {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }} - {{ $avatar_shape := site.Params.avatar.shape | default "circle" }} -
-{{end}}{{/* Profile page block */}} {{end}}{{/* Show profile block */}} diff --git a/layouts/partials/page_author_card.html b/layouts/partials/page_author_card.html new file mode 100644 index 00000000..d04a17f0 --- /dev/null +++ b/layouts/partials/page_author_card.html @@ -0,0 +1,29 @@ +{{ $page := .page }} +{{ $author_urlized := .username }} +{{ $site_type := site.Params.site_type | default "Person" }} +{{ $taxonomy := "authors" }} +{{ $profile_page := site.GetPage (printf "/%s/%s" $taxonomy $author_urlized) }} +{{ with $profile_page }} + {{/* If it's a personal site and primary page author is superuser, link to the homepage rather than their profile page. */}} + {{ $profile_url := .RelPermalink }} + {{ if and (eq $site_type "Person") (eq .Params.superuser true) }} + {{ $profile_url = site.BaseURL }} + {{ end }} + {{ $avatar := (.Resources.ByType "image").GetMatch "*avatar*" }} + {{ $avatar_shape := site.Params.avatar.shape | default "circle" }} + +{{end}}{{/* Profile page block */}}