{{ $image := "" }} {{ if (.Resources.ByType "image").GetMatch "*featured*" }} {{ $image = (.Resources.ByType "image").GetMatch "*featured*" }} {{ else if resources.Get (index .Params.images 0) }} {{ $image = resources.Get (index .Params.images 0) }} {{ end }} {{ with $image }}