summaryrefslogtreecommitdiff
path: root/layouts/shortcodes/img-center.html
diff options
context:
space:
mode:
authorMichał M. Sapka <michal@sapka.me>2023-02-25 19:09:29 +0100
committerMichał M. Sapka <michal@sapka.me>2023-02-25 19:09:29 +0100
commit02f2b53f642ed69d5f4d94e5e294aa6d030450f0 (patch)
treeb7f5a68283c1d630b641b4ed3a23c0ee814d8a5a /layouts/shortcodes/img-center.html
parent4113d544cd36d265e0f6750b7ad86f2f1a4fb33f (diff)
feat: handle retina for post omages
Diffstat (limited to 'layouts/shortcodes/img-center.html')
-rw-r--r--layouts/shortcodes/img-center.html14
1 files changed, 12 insertions, 2 deletions
diff --git a/layouts/shortcodes/img-center.html b/layouts/shortcodes/img-center.html
index a7206c3..ee6425a 100644
--- a/layouts/shortcodes/img-center.html
+++ b/layouts/shortcodes/img-center.html
@@ -3,9 +3,19 @@
{{- $img := resources.Get $path }}
{{- $caption := .Get 1 }}
{{- $source := .Get 2 }}
-{{- $img = $img.Resize "500x webp q90"}}
+{{- $img1x := $img.Resize "500x webp q90"}}
+{{- $img2x := $img.Resize "1000x webp q90"}}
<figure>
- <img class="centered" alt="{{ $caption }}" src="{{ $img.RelPermalink }}" width="{{ $img.Width }}" height="{{ $img.Height }}">
+ <img
+ class="centered"
+ alt="{{ $caption }}"
+ src="{{ $img1x.RelPermalink }}"
+ srcset="
+ {{ $img1x.RelPermalink }} 1x,
+ {{ $img2x.RelPermalink }} 2x,
+ "
+ width="{{ $img1x.Width }}"
+ height="{{ $img1x.Height }}">
<figcaption>
{{ $caption }}