A while back I’ve created a feature request for responsive images in Zola. That one was (rightfully) rejected because it can implemented via a theme / shortcode. I have this implemented for my own blog. If anyone else is interested in this, there is a PR open for even.
Technical Details
The linked PR implements the following solution:
Replace ![some image](foo)
with {{ image(src="foo.jpeg", alt="some image") }}
and configure solutions in your config.toml
:
[extra]
images_default_size = 1000
images_sizes = [500, 1000, 2000]
This results in:
<img alt="some image" src="http://127.0.0.1:1111/processed_images/37a9b7cc6ffae6c700.jpg" srcset="http://127.0.0.1:1111/processed_images/a9c5f86e7153934f00.jpg 500w, http://127.0.0.1:1111/processed_images/37a9b7cc6ffae6c700.jpg 1000w, http://127.0.0.1:1111/processed_images/c5123a96b9f24ad000.jpg 2000w" />
References:
- Even PR: RFC: responsive images by crepererum · Pull Request #48 · getzola/even · GitHub
- Old Zola feature request: [feature request] responsive images · Issue #622 · getzola/zola · GitHub
- … (I would put MDN references here but discourse doesn’t want that)