Files
website-hugo/themes/lhs/layouts/shortcodes/bimage.html
engineershamrock 1c5513c6d8 Large storage custom nas (#62)
NAS Storage blog post

Added `aimage`, `bimage`, `bgallery` and `fimage` custom shortcodes
2024-06-27 23:17:28 +01:00

26 lines
777 B
HTML

{{ $img := .Page.Resources.GetMatch (printf "*%s*" (.Get "src")) }}
{{ $width := .Get "width" }}
{{ $height := .Get "height" }}
{{ $zone := .Get "zone" }}
{{ $img = $img.Resize (print (default "1264x" $width) " webp") }}
{{ $title := .Get "title" }}
{{ $class := .Get "class" }}
{{- with .Parent -}}
<div>
{{ end }}
<div style="display: block; margin-left: auto; margin-right: auto; width: {{ $zone }}%;">
<figure class="image{{ if $class }} {{ $class }}{{ end }}">
<img src="{{ $img.RelPermalink }}" width="{{ $width }}" height="{{ $height }}" {{ if $title }}
alt="{{ $title }}" {{ end }}>
{{ if $title }}
<figcaption class="is-size-6">
<small>
{{ $title }}
</small>
</figcaption>
{{ end }}
</figure>
</div>
{{- with .Parent -}}
</div>
{{ end }}