<figure class="image-wrapper"> {{/* 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 .Title }}<figcaption>{{ .Title }}</figcaption>{{ end }} </figure>