{{- $page := .Page -}} {{- $coverPath := $page.Params.cover -}} {{- $img := false -}} {{- if $coverPath -}} {{- if strings.HasSuffix $coverPath ".yaml" -}} {{- $coverAbsPath := printf "%s%s" $page.File.Dir $coverPath -}} {{- $coverRaw := readFile $coverAbsPath -}} {{- $coverData := $coverRaw | transform.Unmarshal -}} {{- with $coverData.file -}} {{- $img = $page.Resources.GetMatch . -}} {{- end -}} {{- else -}} {{- $img = $page.Resources.GetMatch $coverPath -}} {{- end -}} {{- end -}}