{{- .Page.Scratch.Add "hasImages" "true" -}}
{{- if .Get "folder" -}} {{- $page := .Page -}} {{- $addCaption := eq "true" (default "true" (.Get "captions")) -}} {{- $folder := path.Join "content" (path.Join .Page.File.Dir (.Get "folder")) -}} {{- range readDir $folder -}} {{- if lower .Name | findRE "\\.(apng|ico|cur|jfif|pjpeg|pjp|tif|gif|jpg|jpeg|tiff|png|bmp|webp)" -}} {{- $caption := "" -}} {{- if $addCaption -}} {{ $caption = .Name | replaceRE "\\..*" "" | humanize }} {{- end -}} {{- partial "gallery-image" (dict "src" (path.Join ($.Get "folder") .Name) "Page" $page "caption" $caption) -}} {{- end -}} {{- end -}} {{- else -}} {{- .Inner -}} {{- end -}}
{{/* Glider controls */}}
{{/* Gallery caption */}} {{- if or (.Get "title") (.Get "caption") -}}
{{ with (.Get "title") -}}

{{ . }}

{{- end -}} {{ with (.Get "caption") -}}

{{ . }}

{{- end -}}
{{- end -}}