{{- /* JSON-LD structured data - BlogPosting for a post, WebSite for home/section pages, so a search engine gets headline/author/dates/image without having to infer them from the markup. Takes the same (page, desc, image) shape as opengraph.html; `image` is page-image.html's own dict so the two don't compute it twice and can't disagree on it. */ -}} {{- $page := .page }} {{- $desc := .desc }} {{- $image := .image }} {{- $author := site.Params.profile }} {{- $authorName := "" }} {{- with $author }} {{- $authorName = strings.TrimSpace (printf "%s %s" .firstName .lastName) }} {{- end }} {{- $data := dict "@context" "https://schema.org" "url" $page.Permalink "inLanguage" site.Language.Lang }} {{- with $desc }}{{ $data = merge $data (dict "description" .) }}{{ end }} {{- with $image.url }}{{ $data = merge $data (dict "image" .) }}{{ end }} {{- if $page.IsPage }} {{- $data = merge $data (dict "@type" "BlogPosting" "headline" $page.Title "datePublished" ($page.Date.Format "2006-01-02T15:04:05Z07:00") "dateModified" ($page.Lastmod.Format "2006-01-02T15:04:05Z07:00") "mainEntityOfPage" (dict "@type" "WebPage" "@id" $page.Permalink) ) }} {{- with $authorName }} {{- $data = merge $data (dict "author" (dict "@type" "Person" "name" .) "publisher" (dict "@type" "Person" "name" .)) }} {{- end }} {{- else }} {{- $data = merge $data (dict "@type" "WebSite" "name" site.Title ) }} {{- end }}