{{ $image := "" -}} {{ if (urls.Parse .Destination).IsAbs }} {{ $image = resources.GetRemote .Destination -}} {{ else -}} {{ $image = .Page.Resources.GetMatch .Destination -}} {{ end -}} {{ with $image -}} {{ $lqip := $image.Resize site.Params.lqipWidth -}} {{ $imgSrc := "" -}} {{ $imgSrcSet := slice -}} {{ $widths := site.Params.landscapePhotoWidths -}} {{ if gt $image.Height $image.Width -}} {{ $widths = site.Params.portraitPhotoWidths -}} {{ end -}} {{ range $widths -}} {{ $srcUrl := (printf "%dx" . | $image.Resize).Permalink -}} {{ if eq $imgSrc "" -}}{{ $imgSrc = $srcUrl -}}{{ end -}} {{ $imgSrcSet = $imgSrcSet | append (printf "%s %dw" $srcUrl .) -}} {{ end -}} {{ $imgSrcSet = (delimit $imgSrcSet ",") -}} {{ if gt $image.Width site.Params.smallLimit -}}
{{ $.Text }} {{ with $.Title }}
{{ . | safeHTML }}
{{ end -}}
{{ else -}} {{ $.Text }} {{ end -}} {{ else -}} {{ erroridf "image-not-found" "Image not found" -}} {{ end -}}