gallery.html 640 B

12345678910111213141516
  1. {{ $.Scratch.Set "album" "1" }}
  2. {{ with .Get "album" }}{{ $.Scratch.Set "album" . }}{{ end }}
  3. <div class="gallery">
  4. {{ range (where $.Page.Params.gallery_item "album" ($.Scratch.Get "album")) }}
  5. {{/* Set image path. */}}
  6. {{ $.Scratch.Set "src" .image }}
  7. {{ if gt (len .image) 4 }}
  8. {{ if ne "http" (slicestr .image 0 4) }}
  9. {{ $.Scratch.Set "src" (printf "img/%s" .image | relURL) }}
  10. {{ end }}
  11. {{ end }}
  12. <a data-fancybox="gallery{{ with .album }}-{{.}}{{ end }}" {{ with .caption }}data-caption="{{.}}"{{ end }} href="{{$.Scratch.Get "src"}}">
  13. <img alt="" src="{{$.Scratch.Get "src"}}">
  14. </a>
  15. {{ end }}
  16. </div>