{{ if .IsBlock }} <figure class="image-wrapper"> {{ end }} {{/* Remote image */ -}} {{ if or (hasPrefix .Destination "https://") (hasPrefix .Destination "http://") }} <a class="spotlight" data-title="{{ .Title | default "false" }}" href="{{ .Destination | safeURL }}" > <img src="{{ .Destination | safeURL }}" alt="{{.Text}}"> </a> {{/* Local image */ -}} {{ else }} {{- $img := .Page.Resources.GetMatch .Destination -}} {{- $resizeMimes := slice "image/png" "image/jpeg" -}} {{ if $img -}} <a class="spotlight" data-title="{{ .Title | default "false" }}" href="{{ $img.RelPermalink | safeURL }}"> {{ if in $resizeMimes $img.MediaType.Type -}} <img src="{{ ($img.Fit "1024x1024").RelPermalink | safeURL }}" alt="{{.Text}}"> {{- else -}} <img src="{{ $img.RelPermalink | safeURL }}" alt="{{.Text}}"> {{- end -}} </a> {{- else -}} <img src="/images/image-error.png" alt="{{.Text}}"> {{- end -}} {{- end -}} {{ if and (.IsBlock) (.Title) }}<figcaption>{{ .Title }}</figcaption>{{ end }} {{ if .IsBlock }} </figure> {{ end }}