gmgauthier.com/layouts/shortcodes/fluid_imgs.html

21 lines
615 B
HTML
Raw Normal View History

2021-03-30 20:50:34 +00:00
{{ $paramCount := len .Params }}
{{ if gt $paramCount 0 }}
<div class="pure-g">
{{ range $param := .Params }}
{{ $items := split $param "|" }}
{{ $itemCount := len $items }}
<!-- Item count must be at least 2 as
"class" and "src" must be specified -->
{{ if ge $itemCount 2 }}
<div class="{{ index $items 0 }}">
<div style="padding: 0 .2em">
<img
class="pure-img-responsive"
2022-01-03 12:21:24 +00:00
src="{{ $.Site.Params.blogCdnUrl }}{{ index $items 1 }}"
2021-03-30 20:50:34 +00:00
alt="{{ if ge $itemCount 3 }}{{ index $items 2 }}{{ else }}{{ "" }}{{ end }}">
</div>
</div>
{{ end }}
{{ end }}
</div>
{{ end }}