{{- if .image }} {{- $id := .image -}} {{- if isset .image "id" -}} {{- $id = .image.id -}} {{- end -}} {{- $image := partial "GetMedia" $id -}} {{- if $image -}} {{- $url := $image.url -}} {{- if site.Params.keycdn -}} {{- $url = $image.direct_url -}} {{- end -}} {{- $lazy := default true .lazy -}} {{- $alt := or .alt "" -}} {{- if isset .image "alt" -}} {{- $alt = .image.alt -}} {{- end -}} {{- $width := $image.width -}} {{- $height := $image.height -}} {{- $default := "1280x720" -}} {{- if .desktop -}} {{- $default = .desktop -}} {{- end -}} {{- $crop := false -}} {{- if .crop -}} {{- $crop = true -}} {{- end -}} {{ $image_class := .html_class | default "" }} {{ $is_png := strings.HasSuffix $image.name "png" }} {{ $is_svg := strings.HasSuffix $image.name "svg" }} {{ if $is_png }} {{ $image_class = printf "%s is-png" $image_class }} {{ else if $is_svg }} {{ $image_class = printf "%s is-svg" $image_class }} {{ end }} {{- if $is_svg -}} {{ chomp (plainify $alt) }} {{- else -}} {{ with .sizes.desktop -}} {{- end }} {{ with .sizes.tablet -}} {{- end }} {{ with .sizes.mobile -}} {{- end }} {{ chomp (plainify $alt) }} {{- end -}} {{- end -}} {{- end -}}