Sorry, we don't support your browser.  Install a modern browser

Lazy-loading images in kirbytext and blocks

I think it would be very nice to have a way to allow configuring kirby to enable lazy-loading for all images rendered by kirbytext() or toBlocks() in the config.

Example config:

return [
‘kirbytext’ => [
‘loading’ => ‘eager’
]
];

Currently I can see no way to make images load lazily without adding JavaScript to the page.

2 years ago

And of course the alternative owuld be

‘loading’ => ‘lazy’

2 years ago
1

For blocks, you can alter the default block snippet: https://getkirby.com/docs/cookbook/panel/block-basics#extending-core-blocks__block-snippets

For Kirbytext, I think this could be a nice idea

2 years ago

Thanks, that’s a nice workaround until the option is added to kirbytext(). I’ve been using the blocks field instead of a textarea for everything in new projects anyway ☺️

2 years ago