From f8cedfbcd8a84e8e81182e66fa53e56b9fd59be4 Mon Sep 17 00:00:00 2001 From: Chandler Thompson <3262190+chandlertee@users.noreply.github.com> Date: Sat, 6 Jun 2026 20:58:27 -0500 Subject: [PATCH] fix(schema): resolve article author from data/authors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit schema.html always read the author from .Site.Params.Author, so the structured-data author was the site-level author (or empty) regardless of a post's `authors` front matter — even though the theme supports multiple authors via data/authors/. Resolve the first `authors` key against data/authors/ and emit that author's name, image and sameAs (from their social/links), falling back to the site-level author. Single-author output is unchanged apart from the additive image and sameAs fields. Fixes #2943 Co-Authored-By: Claude Opus 4.8 (1M context) --- layouts/partials/schema.html | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/layouts/partials/schema.html b/layouts/partials/schema.html index 76d6ea0c..0962d439 100644 --- a/layouts/partials/schema.html +++ b/layouts/partials/schema.html @@ -17,6 +17,22 @@ {{ else }} {{- $iso8601 := "2006-01-02T15:04:05-07:00" -}} + {{- /* Resolve the author: first `authors` front matter key looked up in data/authors/, else the site author. */ -}} + {{- $author := .Site.Params.Author -}} + {{- with .Params.authors -}} + {{- with index site.Data.authors (index . 0 | lower) -}} + {{- $author = . -}} + {{- end -}} + {{- end -}} + {{- /* sameAs from social profiles: data/authors uses `social`, the site author uses `links` (each a {platform: url} map). */ -}} + {{- $sameAs := slice -}} + {{- range (or $author.social $author.links) -}} + {{- range $platform, $url := . -}} + {{- if not (strings.HasPrefix $url "mailto:") -}} + {{- $sameAs = $sameAs | append $url -}} + {{- end -}} + {{- end -}} + {{- end -}}