{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} {{ $featured := "" }} {{ $featuredURL := "" }} {{ $thumbnailAspectRatio := site.Params.thumbnailAspectRatio | default "1.5" }} {{ $thumbnailAspectRatio = replaceRE "[^0-9.]" "" $thumbnailAspectRatio }} {{ if eq $thumbnailAspectRatio "" }}{{ $thumbnailAspectRatio = "1.5" }}{{ end }} {{ $featureImageHover := site.Params.list.featureImageHover | default false }} {{ if isset .Page.Params "featureImageHover" }}{{ $featureImageHover = .Page.Params.featureImageHover }}{{ end }} {{ $featureImagePosition := .Page.Params.imagePositionFeature | default site.Params.imagePositionFeature | default site.Params.imagePosition }} {{ $p := .Page }} {{ with partial "functions/feature-image.html" .Page }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $featured = resources.GetRemote . }} {{ else }} {{ $featured = $p.Resources.Get . }} {{ if not $featured }} {{ $featured = resources.Get . }} {{ end }} {{ end }} {{ end }} {{ if not $featured }} {{ $images := .Page.Resources.ByType "image" }} {{ range slice "*feature*" "*cover*" "*thumbnail*" }} {{ if not $featured }}{{ $featured = $images.GetMatch . }}{{ end }} {{ end }} {{ end }} {{ with $featured }} {{ $featuredURL = .RelPermalink }} {{ if not (or $disableImageOptimization (eq .MediaType.SubType "svg")) }} {{ with try (.Resize "600x") }} {{ with .Value }}{{ $featuredURL = .RelPermalink }}{{ end }} {{ end }} {{ end }} {{ end }}