diff options
author | Zachary Betz <zwbetz@gmail.com> | 2018-12-31 06:26:53 +0300 |
---|---|---|
committer | Zachary Betz <zwbetz@gmail.com> | 2018-12-31 06:26:53 +0300 |
commit | 519821dd1d7e556e50f1862fd629ab639b6ab5fd (patch) | |
tree | 9c5d9e8f56c99d1d716a91a57f647ced8729027e /layouts | |
parent | 113b24e510775d7e78c3064351145f2e5a3eaaf5 (diff) |
Add bootstrap card list shortcode
Diffstat (limited to 'layouts')
-rw-r--r-- | layouts/shortcodes/bootstrap-card-list.html | 24 | ||||
-rw-r--r-- | layouts/shortcodes/bootstrap-card.html | 2 |
2 files changed, 25 insertions, 1 deletions
diff --git a/layouts/shortcodes/bootstrap-card-list.html b/layouts/shortcodes/bootstrap-card-list.html new file mode 100644 index 0000000..36cb209 --- /dev/null +++ b/layouts/shortcodes/bootstrap-card-list.html @@ -0,0 +1,24 @@ +{{ 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") }} + {{ else }} + {{ errorf "Invalid image processing command: Must be one of Fit, Fill, or Resize." }} + {{ end }} + + <div class="card {{ .Get "class" }}" style="{{ .Get "style" | safeCSS }}"> + <a href="{{ $original.Permalink }}"> + <img src="{{ $new.Permalink }}" class="card-img-top" alt="{{ .Get "alt" }}"> + </a> + </div> + + {{ end }} +{{ end }}
\ No newline at end of file diff --git a/layouts/shortcodes/bootstrap-card.html b/layouts/shortcodes/bootstrap-card.html index 2551a95..ff2a6e0 100644 --- a/layouts/shortcodes/bootstrap-card.html +++ b/layouts/shortcodes/bootstrap-card.html @@ -8,7 +8,7 @@ {{ else if eq (.Get "command") "Fill" }} {{ $new = $original.Fill (.Get "options") }} {{ else }} - {{ errorf "Invalid image processing command: Must be one of Fit, Fill or Resize." }} + {{ errorf "Invalid image processing command: Must be one of Fit, Fill, or Resize." }} {{ end }} <div class="card {{ .Get "class" }}" style="{{ .Get "style" | safeCSS }}"> |