Prevent image layout shifts in Sanity and Gatsby

Prevent layout shifts due to images by preserving their aspect ratio in Sanity and Gatsby.

Charis Theodoulou
Jun 18 · 2 min read
Image source: blog.logrocket.com

This article covers the approach I am using for this blog to prevent layout shifts from images as they load. My website is built with Gatsby.js, as a web framework and Sanity.io, as a headless CMS.