{{- $lazyload := .Page.Site.Params.lazyload -}}
{{- $imageZoom := .Page.Site.Params.imageZoom -}}
{{- $public_cdn := cond .Page.Site.IsServer "" .Page.Site.Params.publicCDN -}}
{{- $lazyload_image := print $public_cdn ("images/outload.svg" | relURL) -}}
{{- $Alt := .PlainText | safeHTML -}}
{{- if (urls.Parse (.Destination | safeURL)).Scheme -}}
{{- with $Alt -}}
{{- . | markdownify -}}
{{- end -}}
{{- else -}}
{{- $Image := .Page.Resources.GetMatch (printf "%s" (.Destination | safeURL)) -}}
{{- $Permalink := .Destination | relURL | safeURL -}}
{{- $galleryImage := false -}}
{{- $processImage := partial "functions/image-process" (dict "Image" $Image "Site" .Page.Site) -}}
{{- if $processImage.Processed -}}
{{- $galleryImage = true -}}
{{- end -}}
{{- $Permalink = print $public_cdn $processImage.Permalink -}}
{{- with $processImage.SrcsetWebp -}}{{- end -}}
{{- if not (eq $Alt .Page.Title) -}}
{{- with $Alt -}}
{{- . | markdownify -}}
{{- end -}}
{{- end -}}
{{- end -}}