{{ $isJPG := eq (path.Ext .Destination) ".jpg" }} {{ $isPNG := eq (path.Ext .Destination) ".png" }} {{ if ($isJPG) -}} {{ $avifPath:= replace .Destination ".jpg" ".avif" }} {{ $avifPathStatic:= printf "static/%s" $avifPath }} {{ if (fileExists $avifPathStatic) -}} {{- end }} {{ $webpPath:= replace .Destination ".jpg" ".webp" }} {{ $webpPathStatic:= printf "static/%s" $webpPath }} {{ if (fileExists $webpPathStatic) -}} {{- end }} {{- end }} {{ if ($isPNG) -}} {{ $avifPath:= replace .Destination ".png" ".avif" }} {{ $avifPathStatic:= printf "static/%s" $avifPath }} {{ if (fileExists $avifPathStatic) -}} {{- end }} {{ $webpPath:= replace .Destination ".png" ".webp" }} {{ $webpPathStatic:= printf "static/%s" $webpPath }} {{ if (fileExists $webpPathStatic) -}} {{- end }} {{- end }} {{ $img := imageConfig (add "/static" (.Destination | safeURL)) }} {{ .Text }} {{ $url := urls.Parse .Destination }} {{ $altText := .Text }} {{ $caption := .Title }} {{ if findRE "^https?" $url.Scheme }}
{{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ else }} {{ $resource := "" }} {{ if $.Page.Resources.GetMatch ($url.String) }} {{ $resource = $.Page.Resources.GetMatch ($url.String) }} {{ else if resources.GetMatch ($url.String) }} {{ $resource = resources.Get ($url.String) }} {{ end }} {{ with $resource }}
{{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ else }}
{{ $altText }} {{ with $caption }}
{{ . | markdownify }}
{{ end }}
{{ end }} {{ end }}