From 44bc299ca3b21600d2ed1bd01e83ca2ab83bc7ca Mon Sep 17 00:00:00 2001 From: Aditya Telange <21258296+adityatelange@users.noreply.github.com> Date: Sun, 25 Oct 2020 12:49:58 +0530 Subject: [PATCH] json-schema: add support for multiple authors --- layouts/partials/templates/schema_json.html | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/layouts/partials/templates/schema_json.html b/layouts/partials/templates/schema_json.html index a186603b..ff84c97f 100644 --- a/layouts/partials/templates/schema_json.html +++ b/layouts/partials/templates/schema_json.html @@ -41,13 +41,26 @@ {{- else -}} {{ (path.Join .RelPermalink .Params.cover.image ) | absURL }}, {{- end}} - {{- end}} + {{- end -}} "datePublished": {{ .PublishDate }}, "dateModified": {{ .Lastmod }}, - "author": { + {{- with (.Params.author | default .Site.Params.author) }} + "author": + {{- if (eq (printf "%T" .) "[]string") -}} + [{{- range $i, $v := . -}} + {{- if $i }}, {{end -}} + { "@type": "Person", - "name": {{ .Params.author | default .Site.Params.author }} + "name": {{ $v }} + } + {{- end }}], + {{- else -}} + { + "@type": "Person", + "name": {{ . }} }, + {{- end -}} + {{- end }} "mainEntityOfPage": { "@type": "WebPage", "@id": {{ .Permalink | safeHTML }}