From 001e5887bc7b8831dc1da4dbe42ee5cccf0225de Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Tue, 21 Apr 2026 20:46:33 +0300 Subject: 21.04.2026 --- themes/neonxp/layouts/shortcodes/img.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 themes/neonxp/layouts/shortcodes/img.html (limited to 'themes/neonxp/layouts/shortcodes') diff --git a/themes/neonxp/layouts/shortcodes/img.html b/themes/neonxp/layouts/shortcodes/img.html new file mode 100644 index 0000000..994e30f --- /dev/null +++ b/themes/neonxp/layouts/shortcodes/img.html @@ -0,0 +1,21 @@ +{{- $alt := .Get "alt" -}} +{{- $res := .Page.Resources.Get (.Get "src") -}} + +{{- $ws := slice 480 800 -}} +{{- $srcset := slice -}} +{{- range $ws -}} +{{- if (le . $res.Width) -}} +{{- $w := printf "%dx" . -}} +{{- $url := ($res.Resize $w).RelPermalink | safeURL -}} +{{- $fmt := printf "%s %dw" $url . -}} +{{- $srcset = $srcset | append $fmt -}} +{{- end -}} +{{- end -}} + +{{- $set := delimit $srcset "," -}} + +
+ {{ $alt }} +
{{ $alt }}
+
\ No newline at end of file -- cgit v1.2.3