From 804a3a813c76e38bc89d3416be072b6fe3a90c62 Mon Sep 17 00:00:00 2001 From: Brummel Date: Wed, 20 May 2026 22:33:07 +0200 Subject: [PATCH] feat: img shortcode with resize_image and lazy loading Co-Authored-By: Claude Sonnet 4.6 --- templates/shortcodes/img.html | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 templates/shortcodes/img.html diff --git a/templates/shortcodes/img.html b/templates/shortcodes/img.html new file mode 100644 index 0000000..e73b2d5 --- /dev/null +++ b/templates/shortcodes/img.html @@ -0,0 +1,16 @@ +{# Image shortcode with width-based resize and lazy loading. + Usage in markdown: + {{ img(src="team/Olli.jpg", width=400, alt="Dr. Riemann") }} + {{ img(src="carousel/page1.jpg", width=1920, alt="Praxis") }} + Class is optional, e.g. class="float-right". #} + +{%- set source_path = "static/images/" ~ src -%} +{%- set resized = resize_image(path=source_path, width=width, op="fit_width", quality=85) -%} +{{ alt | default(value=