{{- $author := site.Params.author | default dict -}} {{- $profile := site.Home.Params.profile | default dict -}} {{- with or $author.name $profile.name -}} {{- $personID := printf "%s#person" site.Home.Permalink -}} {{- $person := dict "@type" "Person" "@id" $personID "name" . "url" site.Home.Permalink -}} {{- with or $author.jobtitle $profile.jobtitle -}} {{- $person = merge $person (dict "jobTitle" .) -}} {{- end -}} {{- with $author.worksfor -}} {{- $person = merge $person (dict "worksFor" (dict "@type" "Organization" "name" .)) -}} {{- end -}} {{- with or $author.location $profile.location -}} {{- $person = merge $person (dict "homeLocation" (dict "@type" "Place" "name" .)) -}} {{- end -}} {{- with $profile.headshotimage -}} {{- with or (site.Home.Resources.GetMatch .) (resources.GetMatch .) -}} {{- $person = merge $person (dict "image" .Permalink) -}} {{- end -}} {{- end -}} {{- $sameAs := slice -}} {{- range $key, $url := site.Params.socials | default dict -}} {{- if and $url (ne $key "email") -}} {{- $sameAs = $sameAs | append $url -}} {{- end -}} {{- end -}} {{- with $sameAs -}} {{- $person = merge $person (dict "sameAs" .) -}} {{- end -}} {{- $authorRef := dict "@id" $personID -}} {{- $description := $.Description | default site.Params.description | plainify -}} {{- $graph := slice $person -}} {{- if $.IsHome -}} {{- $website := dict "@type" "WebSite" "@id" (printf "%s#website" site.Home.Permalink) "name" site.Title "url" site.Home.Permalink "inLanguage" site.Language.Locale "author" $authorRef "publisher" $authorRef -}} {{- with $description }}{{ $website = merge $website (dict "description" .) }}{{ end -}} {{- $graph = $graph | append $website -}} {{- else if $.IsPage -}} {{- $type := $.Params.schematype | default (cond $.Date.IsZero "WebPage" "BlogPosting") -}} {{- $page := dict "@type" $type "@id" $.Permalink "url" $.Permalink "name" ($.Title | plainify) "inLanguage" site.Language.Locale "isPartOf" (dict "@id" (printf "%s#website" site.Home.Permalink)) -}} {{- with $description }}{{ $page = merge $page (dict "description" .) }}{{ end -}} {{- if eq $type "ProfilePage" -}} {{- $page = merge $page (dict "mainEntity" $authorRef) -}} {{- else if eq $type "BlogPosting" -}} {{- $page = merge $page (dict "headline" ($.Title | plainify) "mainEntityOfPage" $.Permalink "datePublished" ($.Date.Format "2006-01-02T15:04:05Z07:00") "dateModified" ($.Lastmod.Format "2006-01-02T15:04:05Z07:00") "author" $authorRef "publisher" $authorRef ) -}} {{- with $.Params.categories }}{{ $page = merge $page (dict "articleSection" .) }}{{ end -}} {{- with $.Resources.GetMatch "featuredImage" }}{{ $page = merge $page (dict "image" .Permalink) }}{{ end -}} {{- end -}} {{- $graph = $graph | append $page -}} {{- end }} {{- end -}}