{{- define "partials/author-list.html" -}}
{{- $authors := . -}}
{{- if and (ne $authors nil) (gt (len $authors) 0) -}}
{{- " by " -}}
{{- range $i, $a := $authors -}}
{{- if and (ne $i 0) (eq (add $i 1) (len $authors)) -}}and {{ end -}}
{{ $a.name }}
{{- if ne (add $i 1) (len $authors) -}}, {{ end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if .cover -}}
{{- $title := .title -}}
{{- with .cover -}}
{{- end -}}
{{ .title }}
{{- partial "partials/author-list.html" .authors -}}
{{- else -}}
{{ .title }}
{{- partial "partials/author-list.html" .authors -}}
{{- end -}}