{{ $page := . }} {{ $auto := $page.Param "paige.pages.disable_auto_schema" | not }} {{ $pageBase := $page.Param "paige.pages.base_schema" }} {{ $siteBase := $page.Param "paige.site.base_schema" }} {{ range $page.Param "paige.site.schemas" }} {{ end }} {{ range $page.Param "paige.pages.schemas" }} {{ end }} {{ if $auto }} {{ $audios := $page.Params.audio | default slice}} {{ $authors := partial "paige/func-authors.html" $page }} {{ $images := $page.Params.images | default slice }} {{ $keywords := sort (union (union $page.Keywords $page.Params.tags) $page.Params.categories) }} {{ $license := $page.Param "paige.site.license" | markdownify | plainify }} {{ $schema := newScratch }} {{ $videos := $page.Params.videos | default slice }} {{ $schema.Set "@context" "https://schema.org" }} {{ $schema.Set "@type" "Article" }} {{ $schema.Set "url" $page.Permalink }} {{ with $page.Summary }} {{ $schema.Set "abstract" (. | plainify | chomp) }} {{ end }} {{ with $page.Description }} {{ $schema.Set "alternativeHeadline" (plainify .) }} {{ end }} {{ with $page.CurrentSection.Title }} {{ $schema.Set "articleSection" . }} {{ end }} {{ with $audios }} {{ $objects := slice }} {{ range $audios }} {{ $objects = $objects | append (dict "@type" "AudioObject" "url" .) }} {{ end }} {{ $schema.Set "audio" $objects }} {{ end }} {{ with $authors }} {{ $objects := slice }} {{ range $authors }} {{ $email := cond (. | not | not) .Params.paige.author.email "" }} {{ $name := cond (. | not | not) .Params.paige.author.name "" }} {{ $url := cond (. | not | not) .Params.paige.author.url "" }} {{ if or $email $name $url }} {{ $object := newScratch }} {{ with $email }} {{ $object.Set "email" . }} {{ end }} {{ with $name }} {{ $object.Set "name" . }} {{ end }} {{ with $url }} {{ $object.Set "url" . }} {{ end }} {{ $object.Set "@type" "Person" }} {{ $objects = $objects | append $object.Values }} {{ end }} {{ end }} {{ $schema.Set "author" $objects }} {{ end }} {{ with site.Copyright }} {{ $schema.Set "copyrightNotice" (plainify .) }} {{ end }} {{ if and (not $page.Date.IsZero) (ne $page.Date $page.PublishDate) }} {{ $schema.Set "dateCreated" $page.Date }} {{ end }} {{ if not $page.Lastmod.IsZero }} {{ $schema.Set "dateModified" $page.Lastmod }} {{ end }} {{ with and (not $page.PublishDate.IsZero) (ne $page.Date $page.PublishDate) }} {{ $schema.Set "datePublished" $page.PublishDate }} {{ end }} {{ with $page.Description }} {{ $schema.Set "description" (plainify .) }} {{ end }} {{ if not $page.ExpiryDate.IsZero }} {{ $schema.Set "expiresAt" $page.ExpiryDate }} {{ end }} {{ with $page.Title }} {{ $schema.Set "headline" (plainify .) }} {{ end }} {{ with $images }} {{ $objects := slice }} {{ range $images }} {{ $objects = $objects | append (dict "@type" "ImageObject" "url" .) }} {{ end }} {{ $schema.Set "image" $objects }} {{ end }} {{ with site.Language }} {{ $schema.Set "inLanguage" .Lang }} {{ end }} {{ with $keywords }} {{ $schema.Set "keywords" . }} {{ end }} {{ with $license }} {{ $schema.Set "license" (plainify .) }} {{ end }} {{ with $page.Title }} {{ $schema.Set "name" (plainify .) }} {{ end }} {{ with $page.ReadingTime }} {{ $schema.Set "timeRequired" (printf "PT%dM" .) }} {{ end }} {{ with $videos }} {{ $objects := slice }} {{ range $videos }} {{ $objects = $objects | append (dict "@type" "VideoObject" "url" .) }} {{ end }} {{ $schema.Set "video" $objects }} {{ end }} {{ with $page.WordCount }} {{ $schema.Set "wordCount" . }} {{ end }} {{ end }}