From 3881f8f8aef0e6defd49759a43f7e652840c9fd2 Mon Sep 17 00:00:00 2001 From: nevfy Date: Tue, 12 Nov 2024 02:55:52 +0300 Subject: [PATCH] feat: responsive image shortcode --- layouts/shortcodes/responsive-img.html | 30 ++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 layouts/shortcodes/responsive-img.html diff --git a/layouts/shortcodes/responsive-img.html b/layouts/shortcodes/responsive-img.html new file mode 100644 index 0000000..6964da9 --- /dev/null +++ b/layouts/shortcodes/responsive-img.html @@ -0,0 +1,30 @@ +{{ $src := ( resources.Get ( .Get 0 ) ) }} + +{{ $tinyw := default "500" }} +{{ $smallw := default "800" }} +{{ $mediumw := default "1200" }} +{{ $largew := default "2400" }} + +{{ $tiny := $src.Resize (printf "%sx" $tinyw) }} +{{ $small := $src.Resize (printf "%sx" $smallw) }} +{{ $medium:= $src.Resize (printf "%sx" $mediumw) }} +{{ $large := $src.Resize (printf "%sx" $largew) }} + + \ No newline at end of file