{{- $imgs := slice -}} {{- $class := .Get "class" -}} {{- $shouldResize := .Get "shouldResize" | default true -}} {{- $shouldShowTitle := (.Get "shouldShowTitle") | default true -}} {{- if .Get "name" -}} {{- $imgs = $imgs | append (.Page.Resources.GetMatch (.Get "name")) -}} {{- else if .Get "names" -}} {{- range (split (.Get "names") ",") -}} {{- $imgs = $imgs | append ($.Page.Resources.GetMatch .) -}} {{- end -}} {{- else -}} {{ errorf "Missing name or names parameter to figures/image" }} {{- end -}} {{- if lt (len $imgs) 0 -}} {{ errorf "No images found for name(s) parameter" }} {{- end -}}
{{ range $img := $imgs }} {{- $linkedImg := $img -}} {{- if $shouldResize -}} {{ $linkedImg = $img.Fit "1280x1280" }} {{- end -}} {{- $altText := $img.Params.alt | default $img.Title -}} {{ . }} {{- end }}
{{ if and $shouldShowTitle -}} {{- range $imgs -}} {{- if gt (len .Title) 0 -}}
{{ .Title }}
{{- end -}} {{- end -}} {{- end }}