{{ $dir := .Get "gallery_dir" }}
×
<
>
{{ $localPath := string (.Get "gallery_dir") }} {{ $displayTitle := ne (.Get "disp_title") "no" }} {{ $files := .Page.Resources.Match (printf "%s/*" $localPath) }} {{ $imageFiles := slice }} {{ range $files }} {{- $ext := path.Ext .Name | lower -}} {{- if in (slice ".jpg" ".jpeg" ".png" ".gif" ".webp") $ext -}} {{ $imageFiles = $imageFiles | append . }} {{ end }} {{ end }} {{ if and (ge (len $imageFiles) 2) (le (len $imageFiles) 5) }} {{ range $imageFiles }} {{- $imagetitle := index (split .Name ".") 0 -}}
{{ if $displayTitle }}
{{ $imagetitle }}
{{ end }}
{{ end }} {{ else if eq (len $imageFiles) 0 }}
Note:
No images found in "{{ $localPath }}" directory. Make sure your images are in the correct location.
{{ else if eq (len $imageFiles) 1 }}
Note:
Only one image found in "{{ $localPath }}" directory. Gallery needs at least 2 images.
{{ else }}
Note:
Too many images found ({{ len $imageFiles }}). Maximum supported is 5 images.
{{ end }}