diff options
author | Zachary Betz <zwbetz@gmail.com> | 2018-12-31 06:31:56 +0300 |
---|---|---|
committer | Zachary Betz <zwbetz@gmail.com> | 2018-12-31 06:31:56 +0300 |
commit | dfaa80ec0e30225a48753669d1f092c0ef23f289 (patch) | |
tree | 417d03cd39427b1bbab65e30ea55a624104c9bdb | |
parent | 519821dd1d7e556e50f1862fd629ab639b6ab5fd (diff) |
Fix context issue
-rw-r--r-- | layouts/shortcodes/bootstrap-card-list.html | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/layouts/shortcodes/bootstrap-card-list.html b/layouts/shortcodes/bootstrap-card-list.html index 36cb209..f01c249 100644 --- a/layouts/shortcodes/bootstrap-card-list.html +++ b/layouts/shortcodes/bootstrap-card-list.html @@ -1,22 +1,28 @@ +{{ $command := .Get "command" }} +{{ $options := .Get "options" }} +{{ $alt := .Get "alt" }} +{{ $class := .Get "class" }} +{{ $style := .Get "style" }} + {{ with .Page.Resources.ByType "image" }} {{ range . }} {{ $original := . }} {{ $new := "" }} - {{ if eq (.Get "command") "Fit" }} - {{ $new = $original.Fit (.Get "options") }} - {{ else if eq (.Get "command") "Resize" }} - {{ $new = $original.Resize (.Get "options") }} - {{ else if eq (.Get "command") "Fill" }} - {{ $new = $original.Fill (.Get "options") }} + {{ if eq $command "Fit" }} + {{ $new = $original.Fit $options }} + {{ else if eq $command "Resize" }} + {{ $new = $original.Resize $options }} + {{ else if eq $command "Fill" }} + {{ $new = $original.Fill $options }} {{ else }} {{ errorf "Invalid image processing command: Must be one of Fit, Fill, or Resize." }} {{ end }} - <div class="card {{ .Get "class" }}" style="{{ .Get "style" | safeCSS }}"> + <div class="card {{ $class }}" style="{{ $style | safeCSS }}"> <a href="{{ $original.Permalink }}"> - <img src="{{ $new.Permalink }}" class="card-img-top" alt="{{ .Get "alt" }}"> + <img src="{{ $new.Permalink }}" class="card-img-top" alt="{{ $alt }}"> </a> </div> |