{{/*
JSON-LD für Suchmaschinen.
Startseite: die Band (MusicGroup) mit Besetzung, Album und Profilen.
/shows/: ein MusicEvent pro kommender Show mit Ort (TBA-Termine fehlen).
Optional im Show-Front-Matter: city (Ort, sonst wird location genommen)
und address (Straße und Hausnummer). Nur bestätigte Adressen eintragen.
*/}}
{{- $bandID := "/#band" | absURL -}}
{{- $band := dict "@type" "MusicGroup" "@id" $bandID "name" site.Title "url" site.Home.Permalink -}}
{{- if .IsHome -}}
{{- $band = merge $band (dict
"description" site.Params.description
"genre" "Punkrock"
"email" site.Params.email
"logo" ("/img/logo-crop.png" | absURL)
"location" (dict "@type" "Place" "name" "Trier" "address" (dict "@type" "PostalAddress" "addressLocality" "Trier" "addressCountry" "DE"))
"sameAs" (slice site.Params.spotify site.Params.instagram site.Params.youtube)
) -}}
{{- with resources.Get "img/AlbumReleaseParty_Stage_compressed.jpg" }}{{ with .Resize "1200x jpg q80" }}
{{- $band = merge $band (dict "image" .Permalink) -}}
{{- end }}{{ end -}}
{{- with site.GetPage "/about" }}{{ with .Params.members }}
{{- $members := slice -}}
{{- range . }}
{{- $members = $members | append (dict "@type" "OrganizationRole" "roleName" .role "member" (dict "@type" "Person" "name" .name)) -}}
{{- end }}
{{- $band = merge $band (dict "member" $members) -}}
{{- end }}{{ end -}}
{{- $albums := slice -}}
{{- range where (partial "releases.html" .) "kind" "Album" }}
{{- $album := dict "@type" "MusicAlbum" "name" .title "datePublished" (.date.Format "2006-01-02") "byArtist" (dict "@id" $bandID) -}}
{{- with .cover.Resize "800x webp q78" }}{{ $album = merge $album (dict "image" .Permalink) }}{{ end -}}
{{- $albums = $albums | append $album -}}
{{- end }}
{{- with $albums }}{{ $band = merge $band (dict "album" .) }}{{ end -}}
{{- $data := merge (dict "@context" "https://schema.org") $band }}
{{- end -}}
{{- if and (eq .Kind "section") (eq .Section "shows") -}}
{{- $events := slice -}}
{{- range (where .Pages "Date" "ge" now).ByDate }}
{{- if and (not .Params.tba) .Params.location }}
{{- $address := dict "@type" "PostalAddress" "addressLocality" (.Params.city | default .Params.location) "addressCountry" "DE" -}}
{{- with .Params.address }}{{ $address = merge $address (dict "streetAddress" .) }}{{ end -}}
{{- $event := dict
"@type" "MusicEvent"
"name" (printf "%s mit %s" .Title site.Title)
"startDate" (.Date.Format "2006-01-02")
"eventStatus" "https://schema.org/EventScheduled"
"eventAttendanceMode" "https://schema.org/OfflineEventAttendanceMode"
"location" (dict "@type" "Place" "name" .Params.location "address" $address)
"performer" $band
"url" $.Permalink
-}}
{{- with .Params.poster }}{{ $event = merge $event (dict "image" (. | absURL)) }}{{ end -}}
{{- $events = $events | append $event -}}
{{- end }}
{{- end }}
{{- with $events }}
{{- end }}
{{- end -}}