json-schema: add support for multiple authors

This commit is contained in:
Aditya Telange 2020-10-25 12:49:58 +05:30
parent 5b9eaac130
commit 44bc299ca3
No known key found for this signature in database
GPG Key ID: 82E844EF3DA99E77
1 changed files with 16 additions and 3 deletions

View File

@ -41,13 +41,26 @@
{{- else -}} {{- else -}}
{{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}, {{ (path.Join .RelPermalink .Params.cover.image ) | absURL }},
{{- end}} {{- end}}
{{- end}} {{- end -}}
"datePublished": {{ .PublishDate }}, "datePublished": {{ .PublishDate }},
"dateModified": {{ .Lastmod }}, "dateModified": {{ .Lastmod }},
"author": { {{- with (.Params.author | default .Site.Params.author) }}
"author":
{{- if (eq (printf "%T" .) "[]string") -}}
[{{- range $i, $v := . -}}
{{- if $i }}, {{end -}}
{
"@type": "Person", "@type": "Person",
"name": {{ .Params.author | default .Site.Params.author }} "name": {{ $v }}
}
{{- end }}],
{{- else -}}
{
"@type": "Person",
"name": {{ . }}
}, },
{{- end -}}
{{- end }}
"mainEntityOfPage": { "mainEntityOfPage": {
"@type": "WebPage", "@type": "WebPage",
"@id": {{ .Permalink | safeHTML }} "@id": {{ .Permalink | safeHTML }}