• Home
  • About
  • Insights Hub
    • New Posts
    • Technical SEO
    • General Discussion
    • View All Forums
  • Blog
  • Contact
    • Hub
      New posts Search forums
    • What's new
      New posts New profile posts Latest activity
    • Members
      Current visitors New profile posts Search profile posts
    Log in Register
    What's new Search

    Search

    By:
    Advanced search…
    • New posts
    • Search forums
    Menu
    Log in

    Register

    Install the app
    • Home
      • Hub
      • Technical SEO
      You are using an out of date browser. It may not display this or other websites correctly.
      You should upgrade or use an alternative browser.

      Shopify - Preload LCP Images

      • Thread starter Chris
      • Start date Sep 6, 2021
      • Sep 6, 2021
      If LCP (Largest Contentful Paint) images are holding you back from passing Core Web Vitals and/or are being flagged in Google Lighthouse and Pagespeed Insights as an opportunity. I have a potential solution. Use the preload resource hints with Shopify's sideloaded liquid image shortcode triggered at the page template level.

      I cannot guarantee this will work for you as all Shopify themes and page templates differ. But this should at least put you on the right track to take advantage of that opportunity.

      Add the relevant snippet below within the head section of the theme.liquid file. Or if you are using a snippet liquid file to call on DOM head elements. Add it in there instead. Be sure to fully test it, if you get the no-image response it did not work. Keep tweaking and testing until it does.

      Product Page Images

      Code:
      {% if template == "product" %}
      <!-- preload LCP product image -->
      <link rel="preload" href="{{ product | img_url: '450x450' }}" as="image">
      {% endif %}


      Homepage Hero Section Images

      Code:
      {% if template == "index" %}
      <!-- preload LCP Homepage Hero (or pages) image -->
      <link rel="preload" href="{{ section.settings.hero_image | img_url: '450x450' }}" as="image">
      {% endif %}


      Blog Page Images

      Code:
      {% if template == "article" %}
      <!-- preload LCP Blog image -->
      <link rel="preload" href="{{ article.image | img_url: '450x450' }}" as="image">
      {% endif %}

      Did this solution work for you to solve Shopify's LCP (Largest Contentful Paint) images? Please comment below. If this post gains any traction, I shall look at expanding it, again, comment below.
       
      Click to expand...
      C
      Written by

      Chris

      Administrator
      Staff member
      • Messages
        51
      • Reaction score
        0
      • Points
        6
      You must log in or register to reply here.
      Share:
      Facebook Twitter Reddit Pinterest Tumblr WhatsApp Email Share Link

      New Posts

      • vogeldm
        SEO and Digital Marketing services
        • Started by vogeldm
        • Apr 22, 2022
        • Replies: 0
        Technical SEO
      • C
        Dropped .UK Domains 11th April 2022
        • Started by Chris
        • Apr 11, 2022
        • Replies: 0
        General Discussion
      • C
        Google Sheets Regex for excluding subfolders
        • Started by Chris
        • Oct 12, 2021
        • Replies: 0
        Technical SEO
      • C
        Modify or Deploy Meta Viewport - Google Tag Manager
        • Started by Chris
        • Sep 24, 2021
        • Replies: 0
        Technical SEO
      • C
        Open-source tools & projects that use Lighthouse
        • Started by Chris
        • Sep 24, 2021
        • Replies: 0
        Technical SEO
      • C
        How to Force HTTPS using .htaccess (cPanel)
        • Started by Chris
        • Sep 24, 2021
        • Replies: 0
        Technical SEO
      • C
        Canonical Tag Override using Google Tag Manager
        • Started by Chris
        • Sep 24, 2021
        • Replies: 0
        Technical SEO
      • C
        Websites to use DNS Prefetching & Prefetching
        • Started by Chris
        • Sep 24, 2021
        • Replies: 0
        Technical SEO
      • Hub
      • Technical SEO

    Join the Community

    Chris Lever is a freelance SEO Consultant availible for Hire. Join the growing SEO Community Forum to learn new skills.

    Join Us

    Need Help?

    • BB Code
    • Cookie Policy
    • Terms of Use
    • Privacy Policy
    • HTML Sitemap

    Learn More

    • About
    • Availability
    • Popular Posts
    • Projects & Scripts
    • Contact

    Get in Touch

    Chris Lever, Manchester, United Kingdom
    info@chrisleverseo.com
    +44 0161 883 2249

    © 2021 Chris Lever SEO. All rights reserved. Powered by Xenforo

    • This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
      By continuing to use this site, you are consenting to our use of cookies.
      Accept Learn more…