{{- /* schema-jsonld.html — emits JSON-LD based on the page's front-matter schemaType. BreadcrumbList is emitted separately by breadcrumbs.html. Uses dict + jsonify so all values are safely escaped. */ -}} {{- $brand := .Site.Data.brand -}} {{- $type := .Params.schemaType | default "none" -}} {{- if eq $type "Organization" -}} {{- $sameAs := slice -}} {{- range $brand.socialLinks -}} {{- $sameAs = $sameAs | append .url -}} {{- end -}} {{- $data := dict "@context" "https://schema.org" "@type" "Organization" "name" $brand.name "url" .Site.BaseURL "logo" ($brand.logoPath | absURL) "description" $brand.tagline "email" $brand.contactEmail "foundingDate" (printf "%d" (int $brand.foundedYear)) "sameAs" $sameAs -}} {{- end -}} {{- if or .IsHome (eq $type "FAQPage") .Params.showFaqAccordion -}} {{- $faqKey := printf "faq.%s" .Language.Lang -}} {{- $faqs := index .Site.Data $faqKey -}} {{- if not $faqs -}}{{- $faqs = .Site.Data.faq -}}{{- end -}} {{- $items := slice -}} {{- range $faqs -}} {{- $items = $items | append (dict "@type" "Question" "name" .question "acceptedAnswer" (dict "@type" "Answer" "text" .answer) ) -}} {{- end -}} {{- $data := dict "@context" "https://schema.org" "@type" "FAQPage" "mainEntity" $items -}} {{- end -}} {{- if and (eq $type "Article") .Params.showRatingWidget -}} {{- $authorName := .Params.authorName | default $brand.name -}} {{- $authorType := cond (isset .Params "authorName") "Person" "Organization" -}} {{- $data := dict "@context" "https://schema.org" "@type" "Review" "headline" (.Params.h1 | default .Title) "url" .Permalink "datePublished" (.Date.Format "2006-01-02") "dateModified" (.Lastmod.Format "2006-01-02") "author" (dict "@type" $authorType "name" $authorName) "publisher" (dict "@type" "Organization" "name" $brand.name "logo" (dict "@type" "ImageObject" "url" ($brand.logoPath | absURL))) "itemReviewed" (dict "@type" "Organization" "name" $brand.name) "reviewRating" (dict "@type" "Rating" "ratingValue" (.Params.rating | default $brand.ratingValue) "bestRating" 5 "worstRating" 1) -}} {{- else if eq $type "Article" -}} {{- $data := dict "@context" "https://schema.org" "@type" "Article" "headline" (.Params.h1 | default .Title) "url" .Permalink "datePublished" (.Date.Format "2006-01-02") "dateModified" (.Lastmod.Format "2006-01-02") "author" (dict "@type" "Organization" "name" $brand.name) "publisher" (dict "@type" "Organization" "name" $brand.name "logo" (dict "@type" "ImageObject" "url" ($brand.logoPath | absURL))) -}} {{- end -}}