summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/img-pull-right.html
blob: 49f2ed7e7e8faa08637b56372752833fa5e85f3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
{{- $file := .Get 0 }}
{{- $path := printf "content_images/%s" $file}}
{{- $img := resources.Get $path }}
{{- $img1x := $img.Resize "150x jpg" }}
{{- $img2x := $img.Resize "300x jpg" }}
{{- $caption := .Get 1}}
<img
  loading="lazy" 
  class="float-right" 
  alt="{{ $caption }}" 
  src="{{ $img1x.Permalink }}" 
  srcset="
    {{ $img1x.Permalink }} 1x,
    {{ $img2x.Permalink }} 2x
  "
  width="{{ $img1x.Width }}" 
  height="{{ $img1x.Height }}"
>