gallery.html 787 B

1234567891011121314151617181920212223242526272829
  1. {{ $command := .Get "command" }}
  2. {{ $options := .Get "options" }}
  3. {{ with .Page.Resources.ByType "image" }}
  4. {{ range . }}
  5. {{ $original := . }}
  6. {{ $new := "" }}
  7. {{ if eq $command "Fit" }}
  8. {{ $new = $original.Fit $options }}
  9. {{ else if eq $command "Fill" }}
  10. {{ $new = $original.Fill $options }}
  11. {{ else if eq $command "Resize" }}
  12. {{ $new = $original.Resize $options }}
  13. {{ else if eq $command "Original" }}
  14. {{ $new = $original }}
  15. {{ else }}
  16. {{ errorf "Invalid image processing command: Must be one of Fit, Fill, Resize, Original." }}
  17. {{ end }}
  18. <div class="gallery">
  19. <a href="{{ $original.RelPermalink }}" class="img-link">
  20. <img src="{{ $new.RelPermalink }}">
  21. </a>
  22. </div>
  23. {{ end }}
  24. {{ end }}