Watch a live product demo 👀 See how Sanity powers richer commerce experiences

How to improve image loading with Gatsby and gatsby-plugin-sanity-image?

9 replies
Last updated: Nov 27, 2020
how do I achieve this same result and avoid this content jankiness (image pushing down content) in Sanity?
I am currently editing
Blog with Gatsby
template but so far dumbfounded on how to solve this with sanity (gatsby-image seems to do it for you). Do I modify in this file here?
or somehow I can achieve this “lazy-loading” effect by combining both
Nov 25, 2020, 5:37 PM
it seems from observation and this is anecdotal, seems like Gatsby solution do something like this to avoid the content jump
will investigate how can I figure this out for sanity on gatstby
Nov 25, 2020, 5:45 PM
I just published gatsby-plugin-sanity-image to provide an easy way to handle this. Use the
version to avoid the CLS issue.
Nov 25, 2020, 6:12 PM
shout out to
user L
now I have a solid base to start figuring this jank-free content layout. With
Slow 3G
network on devtools I have
right away!
Nov 26, 2020, 4:55 PM
kinda looks this with
from the markup it seems like it does something differently
Nov 26, 2020, 4:57 PM
You can get those thumbnails to scale up and keep your content from jumping around by putting the image in a container sized how you want, then setting the CSS on the image to
display: block; width: 100%
. Unless you are cropping the image, the LQIP should be the same aspect ratio. If you are cropping the image, you can instead set the absolute dimensions on the img element and use
object-fit: cover
on it.
Nov 26, 2020, 5:00 PM
user L
to the rescue! thanks that’s a really good pointer
Nov 26, 2020, 5:20 PM
user L
is there a way to enable discussion tab on since I encounter difficulties on resizing the
which I am not sure if it’s a bug (hence i dont think i should create an issue ticket) but I also want to ask how since I tried and failed
Nov 27, 2020, 6:14 AM
figured it out by setting the CSS for
and its all worked out now! highly recommend this plugin! Now I know how to make the site jank-free 🥳
Nov 27, 2020, 8:27 AM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
After adding the subtitle and running this code npm run graphql-deploy It does nothingSep 15, 2020
how to limit a reference to just one entry in Studio reference input side versus the default as-many-entries-as-you-fill-in-an-array...Sep 18, 2020
Is it possible to fetch more than one "_type" using GROQ?Nov 2, 2020
I want to add a view with the Structure builder (S.view.component) where I list similar documents based on the title. What...Sep 23, 2020
Is there a structure builder example where the format of each preview for the document list is modified?Feb 3, 2021
I have an array of references to a country schema type but it always just returns NULL values for meJan 30, 2021
Hi, I need help with a query for getting the url of an image asset. Here is what I've been trying, but I only get the _ref...Dec 1, 2020
Sanity UI looks brilliant :smiley: Is something like the current date picker possible at the moment? I’m not sure if anicon...Dec 21, 2020
Hey everyone. I have been coding and may have potentially accidentally deleted something. Does anyone know how to resolve...Dec 26, 2020
Hello everyone and happy new year :raised_hands::skin-tone-2:, I have a problem with outputting Portable Text :disappointed:...Jan 1, 2021

Related contributions

- Made with Sanity

Complex product offering with nested product structure and tiered pricing.

Kevin Green
Go to Occo

Figma Config
- Made with Sanity

Website for Config, the global design conference by Figma.

Corey Ward
Go to Figma Config

The Agnes
- Made with Sanity

A high end rental real estate site built with Gatsby, Sanity and Shopify that pulls in listing data via API and includes a headless Shopify shop.

David Gross
Go to The Agnes