add a shortcode for placing images. page section bloc, others details

This commit is contained in:
2023-11-13 15:02:34 +01:00
parent 52bedce0ce
commit fc2872e03e
9 changed files with 173 additions and 35 deletions

View File

@@ -0,0 +1,25 @@
{{/* layouts/shortcodes/place-image.html */}}
{{ $base := ref . "." }}
{{ $src := .Get "src" }}
{{ $baseSrc := print $base $src }}
{{ $alt := .Get "alt" }}
{{ $class := .Get "class" }}
{{ $float := .Get "float" }}
{{ $width := .Get "width" }}
{{ $height := .Get "height" }}
<figure class="image {{ with $float }}{{ $float }}{{ else }}center{{ end }}">
<img src="{{ $baseSrc }}"
alt="{{ $alt }}"
class="{{ $class }}"
width="{{ $width }}"
height="{{ $height }}"
>
{{ with .Get "caption" }}
<figcaption>
{{ . }}
</figcaption>
{{ end }}
</figure>