{{/* section label: Gallery about: A grid of pictures that open full size, with captions. fields: - { name: heading, type: text } - { name: intro, type: markdown } - { name: columns, type: select, options: ["2", "3", "4"], default: "3", label: Pictures per row } - name: items type: list label: Pictures fields: - { name: image, type: image, required: true } - { name: alt, type: text, label: What the picture shows, required: true } - { name: caption, type: text } - { name: from, type: data, label: Pictures from, help: A file in data/ that holds the pictures. Leave empty to use the pictures above. } */}} {{ $items := .Data.items }}{{ with .Data.from }}{{ $items = data . }}{{ end }} {{ $g := printf "gallery-%d" .Index }}{{ $n := len $items }} {{ with .Data.heading }}{{ . }}{{ end }} {{ with .Data.intro }}{{ markdownify . }}{{ end }} {{ range $i, $p := $items }} {{ with $p.caption }}{{ . }}{{ end }} {{ end }} {{ range $i, $p := $items }} {{ with $p.caption }}{{ . }}{{ end }} {{ if gt $i 0 }}Previous{{ end }} {{ add $i 1 }} of {{ $n }} {{ if lt (add $i 1) $n }}Next{{ end }} Close {{ end }}