diff options
author | Michał M. Sapka <michal@sapka.me> | 2023-02-25 19:09:29 +0100 |
---|---|---|
committer | Michał M. Sapka <michal@sapka.me> | 2023-02-25 19:09:29 +0100 |
commit | 02f2b53f642ed69d5f4d94e5e294aa6d030450f0 (patch) | |
tree | b7f5a68283c1d630b641b4ed3a23c0ee814d8a5a /layouts/shortcodes/img-pull-right.html | |
parent | 4113d544cd36d265e0f6750b7ad86f2f1a4fb33f (diff) |
feat: handle retina for post omages
Diffstat (limited to 'layouts/shortcodes/img-pull-right.html')
-rw-r--r-- | layouts/shortcodes/img-pull-right.html | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/layouts/shortcodes/img-pull-right.html b/layouts/shortcodes/img-pull-right.html index 8d73f48..4688b59 100644 --- a/layouts/shortcodes/img-pull-right.html +++ b/layouts/shortcodes/img-pull-right.html @@ -1,6 +1,17 @@ {{- $file := .Get 0 }} {{- $path := printf "content_images/%s" $file}} {{- $img := resources.Get $path }} -{{- $img = $img.Resize "150x webp" }} +{{- $img1x := $img.Resize "150x webp" }} +{{- $img2x := $img.Resize "300x webp" }} {{- $caption := .Get 1}} - <img class="float-right" alt="{{ $caption }}" src="{{ $img.Permalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}"> + <img + class="float-right" + alt="{{ $caption }}" + src="{{ $img1x.Permalink }}" + srcset=" + {{ $img1x.RelPermalink }} 1x, + {{ $img2x.RelPermalink }} 2x, + " + width="{{ $img1x.Width }}" + height="{{ $img1x.Height }}" +> |