summaryrefslogtreecommitdiffstats
path: root/layouts/partials/author.html
blob: efb1dbd37dd37d05b63bfdf36b41287b9c96cd2b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{{- /* First, check for current page author(s) */}}
{{- if .Params.author }}
    {{- $author_type := (printf "%T" .Params.author) }}
    {{- if (or (eq $author_type "[]string") (eq $author_type "[]interface {}")) }}
        {{- (delimit .Params.author ", " ) }}
    {{- else }}
        {{- .Params.author }}
    {{- end }}

{{- /* Otherwise, get site authors */}}
{{- else }}
    {{- if site.Author }}
        {{- $author_type := (printf "%T" site.Author) }}
        {{- if (or (eq $author_type "map[string]string") (eq $author_type "map[string]interface {}")) }}
            {{- range $i, $author := site.Author }}
                {{- $name_type := (printf "%T" $author) }}
                {{- if (eq $name_type "maps.Params") }}
                    {{- with $author.name }}{{ $.Scratch.SetInMap "names" . . }}{{ end }}
                {{- else }}
                    {{- $.Scratch.SetInMap "names" site.Author.name site.Author.name }}
                    {{- break -}}
                {{- end }}
            {{- end }}
            {{- delimit ($.Scratch.GetSortedMapValues "names") ", " }}
            {{- $.Scratch.Delete "names" -}}
        {{- end }}
    {{- end -}}
{{- end -}}