Fix Largest Contentful Paint image was lazily loaded error on Shopify theme

Making Shopify themes faster is something that has become increasingly important. Not only does Google care about the performance of your website, but more importantly your users do too.
In this video, we'll walk through one of the simplest performance wins you can implement into your Shopify theme that proves to carry the greatest benefit - improving the Largest Contentful Paint (LCP) metric.
In many instances, Shopify themes are implementing best practices with lazy loading images. This ensures that resources aren't called until they are needed when a user scrolls to the image on the page. However, this is not something we want to implement when the image is "above the fold" or immediately in the viewport when the page loads.
This is because of the importance of the LCP.
Making sure the LCP, most often cases (but not always) an image, loads quickly ensures that we can take full advantage of performance benefits with below the fold images not impacting a fast load for above the fold content.
----
00:00 - Introduction
00:51 - Example of LCP Lazily Loaded vs Not
02:25 - LCP and Why It’s Important
03:44 - How to Opt In/Out of Lazy Loading
07:25 - Tag Filter Option via Liquid
09:49 - Testing Code
11:21 - Closing
----
// Video Resources //
Shopify Dev Docs: shopify.dev/docs/themes
Largest Contentful Paint: web.dev/lcp/
Lighthouse Scoring Calculator: googlechrome.github.io/lighth...
// General Links //
Website: www.thepagesmedia.com
Twitter: / trpage_dev
LinkedIn: / tr-page
Instagram: / thepagesmedia
// Hardware* //
💻 2022 Apple MacBook Pro (16-inch, Apple M1, 32GB RAM, 1TB SSD): amzn.to/3iv4Xmo
🎙️Rode NT-USB USB Condenser Microphone: amzn.to/3VrlmqJ
⌨️ Keychron K4J2 Mechanical Keyboard: amzn.to/3OXO2Vz
🎧 Bose QuietComfort 45: amzn.to/3hhdidd
🪑 MUIGELS Ergonomic Mesh Office Chair: amzn.to/3EnUn8X
*Some of the items may contain affiliate links and it's possible that I may receive a small commission if you use the link

Пікірлер: 21

  • @EdTLive
    @EdTLive3 ай бұрын

    This is gold! Page performance went from 40 to 58 immediately after applying this fix.

  • @zayadhajhouji3608
    @zayadhajhouji36089 ай бұрын

    Bro, you are a beast thank you so much for this tutorial, God bless you

  • @Vcastro1995
    @Vcastro19959 ай бұрын

    This really helped out, increased my mobile site speed

  • @jamesstevens2444
    @jamesstevens244411 ай бұрын

    Most helpful video. It turned out my site was lazy loading too. Got rid of the fade in too!

  • @13111y
    @13111y Жыл бұрын

    Absolutely brilliant - thank you very much.

  • @TRPage_dev

    @TRPage_dev

    Жыл бұрын

    Glad you found it useful!

  • @adriancasillas8675
    @adriancasillas8675 Жыл бұрын

    Good one!

  • @ammarahmad7963
    @ammarahmad79639 ай бұрын

    How will it work on the slideshow image? It is not working on the slideshow

  • @victorbustos178
    @victorbustos1788 ай бұрын

    Nice video. I'd like to ask: what would you do if the problem is with the featured category? How can you apply the same solution to items loaded on the main page? I've tried to fix that but haven't found a solution yet."

  • @TRPage_dev

    @TRPage_dev

    8 ай бұрын

    This is just the simplest implementation I could showcase here - if you want to do this in a different section or category, you'd just need to find in the code where the image is loading and leverage this same sort of conditional split to serve content one way or another.

  • @assaadzouhairi8770
    @assaadzouhairi87705 ай бұрын

    Hi , i have some problem with lazy load image if you can help me to fix this please

  • @idoxido
    @idoxido7 ай бұрын

    Why do I get "Invalid schema: setting with id="disable_lazy" default must be a boolean"?

  • @concept1000
    @concept10006 ай бұрын

    Hi Taylor, I am using Dawn 12.0.0 and am trying to replicae the process in your video. However when I go into my 'image-with-text.liquid' there is no reference to 'lazy'. Can you assit me at all please?

  • @TRPage_dev

    @TRPage_dev

    6 ай бұрын

    This is a good callout, as in the newest version of Dawn (12.0.0 as of today) this is an unnecessary change because it's utilizing the new Liquid property for section.index. It will natively not lazyload and this fix is no longer required. I need to do an updated video on sections not leveraging this instead. This sort of a fix is only necessary for earlier versions of Dawn (before 12.0.0).

  • @concept1000

    @concept1000

    6 ай бұрын

    @@TRPage_dev Thanks for getting back to me. Do you think you feature in the video update, how to add lazy loading below the fold (if that is possible). Thanks again & great video!!

  • @TRPage_dev

    @TRPage_dev

    6 ай бұрын

    @@concept1000 native HTML lazyloading already is one of the best ways to go, but using the liquid tags also allow for loading attributes to indicate lazy vs eager. Great suggestions, I need to get back into doing these videos - just need to find the time!

  • @JoaumPDR
    @JoaumPDR10 күн бұрын

    hey man, im trying to remove lazyload from my product page and when i delete the loading=lazy the image disapears. Do you have any clue what i can do?

  • @TRPage_dev

    @TRPage_dev

    6 күн бұрын

    A lot of this is going to depend on your theme and version. There are some themes now as well where there's an updated method for this based on a newly available Liquid property for section index (which would be the new way forward). It's possible your theme already has this implemented.

  • @JoaumPDR

    @JoaumPDR

    6 күн бұрын

    @@TRPage_dev im using a theme called warehouse, have you heard of? And about that updated method do you have any recommendations on where i can lean or search about? Any help would be great, my LCP (the image of the product) is super high and 50-70% of its loading time is delayed because of lazyloading

  • @ReneaHanks
    @ReneaHanks Жыл бұрын

    'schema' tag must not be nested inside other tags this is the error I keep getting.

  • @TRPage_dev

    @TRPage_dev

    Жыл бұрын

    If you're getting this error, it's very likely you've accidentally inserted an extra comma or forgot to close a parentheses when updating your schema - essentially "breaking" it. You may want to try and use a Shopify schema tag builder to compare, here's one a friend has recommended in the past: encircletechnologies.com/shopify-schema-builder-tool/