add a shortcode for placing images. page section bloc, others details
This commit is contained in:
25
themes/hugoplate/layouts/shortcodes/place-image.html
Normal file
25
themes/hugoplate/layouts/shortcodes/place-image.html
Normal 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>
|
Reference in New Issue
Block a user