{{- /* partials/meta/json-ld.html — JSON-LD structured data (Schema.org) Emits one " ($data | jsonify) | safeHTML -}} {{- else -}} {{- /* ── Article / TechArticle / WebPage ─────────────────────────── */}} {{- $schemaType := "WebPage" -}} {{- if and .IsPage (not .IsSection) -}} {{- if eq .Params.type "docs" -}} {{- $schemaType = "TechArticle" -}} {{- else if .Date -}} {{- $schemaType = "Article" -}} {{- end -}} {{- end -}} {{- $publisher := dict "@type" "Organization" "name" $author -}} {{- with $logo -}} {{- $publisher = merge $publisher (dict "logo" (dict "@type" "ImageObject" "url" (. | absURL))) -}} {{- end -}} {{- $data := dict "@context" "https://schema.org" "@type" $schemaType "headline" .Title "description" $desc "url" .Permalink "author" $publisher "publisher" $publisher -}} {{- with $image -}} {{- $data = merge $data (dict "image" (. | absURL)) -}} {{- end -}} {{- if and .Date (not .IsSection) -}} {{- $data = merge $data (dict "datePublished" (.Date.Format "2006-01-02T15:04:05Z07:00") "dateModified" (.Lastmod.Format "2006-01-02T15:04:05Z07:00") ) -}} {{- end -}} {{- /* BreadcrumbList: .Ancestors is nearest→root; iterate by index to reverse */}} {{- with .Ancestors -}} {{- $ancs := . -}} {{- $len := len $ancs -}} {{- $items := slice -}} {{- range $i := seq $len -}} {{- $a := index $ancs (sub $len $i) -}} {{- $item := dict "@type" "ListItem" "position" $i "name" $a.Title "item" $a.Permalink -}} {{- $items = $items | append $item -}} {{- end -}} {{- $last := dict "@type" "ListItem" "position" (add $len 1) "name" $.Title "item" $.Permalink -}} {{- $items = $items | append $last -}} {{- $crumb := dict "@type" "BreadcrumbList" "itemListElement" $items -}} {{- $data = merge $data (dict "breadcrumb" $crumb) -}} {{- end -}} {{- printf "" ($data | jsonify) | safeHTML -}} {{- end }}