From 6c4cbf8578d8a94964ca7327a7826c7c094f94fc Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Mon, 2 Feb 2026 18:57:20 +0300 Subject: Fix images --- 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