How to add an attribute to the element IMG?

I use the default starter kit and add images by the standard tag
(image: 02.jpg alt: Lorem ipsum)
in the standard markdown editor.

How can add the attribute
loading="lazy"
to all img in a minimalistic way in Kirby. What is the official way to do that?

Adding loading="lazy" to all images doesn’t really make sense, as this attribute should only be added to image to images “below the fold”.

Having said that, you can extend the image kirbytag and attributes and what the tag renders, see KirbyTags | Kirby CMS.

You can find an example in the getkirby.com repo: getkirby.com/site/plugins/site/extensions/tags.php at main · getkirby/getkirby.com · GitHub

Hi Sonja.
I don’t understand what you want to use to determine the vertical position at which an img should receive the attribute.

To do this, the viewport height would have to be queried beforehand.

So far, I understand the purpose of loading="lazy" to be that it is added to every image and the browser loads images that are in the viewport.

About the Kirby Tag:
Should I change an existing default Kirby tag?
I don’t understand where to find the default Kirby tag for img.