{{ $disableImageOptimization := .Page.Site.Params.disableImageOptimization | default false }} {{ $featured := "" }} {{ $featuredURL := "" }} {{ with .Page.Params.featureimage }} {{ if or (strings.HasPrefix . "http:") (strings.HasPrefix . "https:") }} {{ $featured = resources.GetRemote . }} {{ else }} {{ $featured = resources.Get . }} {{ 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")) }} {{ $featuredURL = (.Resize "600x").RelPermalink }} {{ end }} {{ end }}