2 {{- $imgParams := .Params.images }}
3 {{- $resources := .Resources.ByType "image" -}}
4 {{/* Find featured image resources if the images parameter is empty. */}}
5 {{- if not $imgParams }}
6 {{- $featured := $resources.GetMatch "*feature*" -}}
7 {{- if not $featured }}{{ $featured = $resources.GetMatch "{*cover*,*thumbnail*}" }}{{ end -}}
9 {{- $imgs = $imgs | append (dict
11 "RelPermalink" .RelPermalink
12 "Permalink" .Permalink) }}
15 {{/* Use the first one of site images as the fallback. */}}
16 {{- if and (not $imgParams) (not $imgs) }}
17 {{- with site.Params.images }}
18 {{- $imgParams = first 1 . }}
21 {{/* Parse page's images parameter. */}}
22 {{- range $imgParams }}
24 {{- $url := urls.Parse $img }}
25 {{- if eq $url.Scheme "" }}
26 {{/* Internal image. */}}
27 {{- with $resources.GetMatch $img -}}
28 {{/* Image resource. */}}
29 {{- $imgs = $imgs | append (dict
31 "RelPermalink" .RelPermalink
32 "Permalink" .Permalink) }}
34 {{- $imgs = $imgs | append (dict
35 "RelPermalink" (relURL $img)
36 "Permalink" (absURL $img)
40 {{/* External image */}}
41 {{- $imgs = $imgs | append (dict