summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/img-r.html
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/shortcodes/img-r.html')
-rw-r--r--layouts/shortcodes/img-r.html17
1 files changed, 17 insertions, 0 deletions
diff --git a/layouts/shortcodes/img-r.html b/layouts/shortcodes/img-r.html
new file mode 100644
index 0000000..4340792
--- /dev/null
+++ b/layouts/shortcodes/img-r.html
@@ -0,0 +1,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 := .Inner}}
+ <img
+ class="float-right"
+ alt="{{ $caption }}"
+ src="{{ $img1x.Permalink }}"
+ srcset="
+ {{ $img1x.RelPermalink }} 1x,
+ {{ $img2x.RelPermalink }} 2x
+ "
+ width="{{ $img1x.Width }}"
+ height="{{ $img1x.Height }}"
+>