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