{{- $work := .work }} {{- $works := .works }} {{- $creators := .creators }} {{- /* This is really ugly, but alas, it is precisely what we need. */ -}}
{{ $work.title }} by {{ range $k, $author := $work.authors }} {{- if index $creators $author }}{{ $author | markdownify }}{{ else }}{{ $author | markdownify }}{{ end }} {{- if ne (add $k 1) ($work.authors | len) }}, {{ end }} {{- end }} {{- range $contributor := $work.contributors }}, {{ if index $creators $contributor }}{{ $contributor | markdownify }}{{ else }}{{ $contributor | markdownify }}{{ end }} (contributor) {{- end }}
{{ $work.description | markdownify }} {{- $subworks := where $works "parent" "eq" $work.title }} {{- if gt (len $subworks) 0 }}

Associated works

{{- range $subwork := where $works "parent" "eq" $work.title }} {{ partial "work.html" (dict "work" $subwork "works" $works "creators" $creators) }} {{- end }}
{{- end }}