{{/* Built as a map and emitted in one interpolation: Hugo serialises it as JSON, so optional fields can never leave a dangling comma behind. */}} {{ with .Site.Params.event }} {{ $d := dict "@context" "https://schema.org" "@type" "Event" "name" .name "startDate" .startDate }} {{ with .endDate }}{{ $d = merge $d (dict "endDate" .) }}{{ end }} {{ with .description }}{{ $d = merge $d (dict "description" .) }}{{ end }} {{ with .attendanceMode }}{{ $d = merge $d (dict "eventAttendanceMode" (printf "https://schema.org/%s" .)) }}{{ end }} {{ with .status }}{{ $d = merge $d (dict "eventStatus" (printf "https://schema.org/%s" .)) }}{{ end }} {{ $place := dict "@type" "Place" "name" .PlaceName }} {{ with .address }} {{ $place = merge $place (dict "address" (dict "@type" "PostalAddress" "streetAddress" .streetAddress "addressLocality" .locality "postalCode" .postalCode "addressCountry" .country)) }} {{ end }} {{ $d = merge $d (dict "location" $place) }} {{ with .image }} {{ with resources.GetMatch . }} {{ $image := . }} {{ if ne $image.MediaType.SubType "svg" }}{{ $image = $image.Resize "960x" }}{{ end }} {{ $d = merge $d (dict "image" $image.Permalink) }} {{ end }} {{ end }} {{ with .offer }} {{ $offer := dict "@type" "Offer" "price" .price "priceCurrency" .priceCurrency "availability" (printf "https://schema.org/%s" .availability) "description" .description "url" .url }} {{ with .validFrom }}{{ $offer = merge $offer (dict "validFrom" .) }}{{ end }} {{ $d = merge $d (dict "offers" $offer) }} {{ end }} {{ $speakersList := slice }} {{ range hugo.Data.event }}{{ range .events }}{{ range .speakers }}{{ $speakersList = $speakersList | append . }}{{ end }}{{ end }}{{ end }} {{ with $speakersList }} {{ $performers := slice }} {{ range ($speakersList | uniq | sort) }} {{ $performers = $performers | append (dict "@type" "Person" "name" .) }} {{ end }} {{ $d = merge $d (dict "performer" $performers) }} {{ end }} {{ with $.Site.Params.organization }} {{ $org := dict "@type" "Organization" "name" .name }} {{ with .url }}{{ $org = merge $org (dict "url" .) }}{{ end }} {{ with .logo }} {{ with resources.GetMatch . }} {{ $org = merge $org (dict "logo" (dict "@type" "ImageObject" "url" .Permalink)) }} {{ end }} {{ end }} {{ $d = merge $d (dict "organizer" $org) }} {{ end }} {{ end }}