cupper-hugo-theme/layouts/shortcodes/gallery.html

30 lines
787 B
HTML
Raw Normal View History

2019-02-13 20:54:04 +01:00
{{ $command := .Get "command" }}
{{ $options := .Get "options" }}
{{ with .Page.Resources.ByType "image" }}
{{ range . }}
{{ $original := . }}
{{ $new := "" }}
{{ if eq $command "Fit" }}
{{ $new = $original.Fit $options }}
{{ else if eq $command "Fill" }}
{{ $new = $original.Fill $options }}
{{ else if eq $command "Resize" }}
{{ $new = $original.Resize $options }}
{{ else if eq $command "Original" }}
{{ $new = $original }}
{{ else }}
{{ errorf "Invalid image processing command: Must be one of Fit, Fill, Resize, Original." }}
{{ end }}
<div class="gallery">
2020-11-25 03:51:01 +01:00
<a href="{{ $original.RelPermalink }}" class="img-link">
<img src="{{ $new.RelPermalink }}">
2019-02-13 20:54:04 +01:00
</a>
</div>
{{ end }}
{{ end }}