{{- $page := . -}} {{- $data := dict -}} {{- if reflect.IsMap . -}} {{- with index . "Page" -}} {{- $page = . -}} {{- end -}} {{- with index . "Data" -}} {{- $data = . -}} {{- end -}} {{- end -}} {{- if eq (len $data) 0 -}} {{- $data = partialCached "head/data.html" $page $page.RelPermalink -}} {{- end -}} {{- $socialImage := index $data "socialImage" -}} {{- $openGraphImage := $socialImage.openGraph -}} {{- $image := dict -}} {{- with $openGraphImage.url -}} {{- $image = dict "@type" "ImageObject" "url" . -}} {{- with $openGraphImage.width -}} {{- $image = merge $image (dict "width" .) -}} {{- end -}} {{- with $openGraphImage.height -}} {{- $image = merge $image (dict "height" .) -}} {{- end -}} {{- with $openGraphImage.alt -}} {{- $image = merge $image (dict "caption" .) -}} {{- end -}} {{- end -}} {{- return $image -}}