Boosting Shopify PageSpeed: Unpacking Oversized Thumbnail Warnings in Dawn Theme

Boosting Shopify PageSpeed: Unpacking Oversized Thumbnail Warnings in Dawn Theme

Hey fellow store owners and Shopify enthusiasts!

If you've ever run your Shopify store through Google PageSpeed Insights, you've probably seen that nagging "image file is larger than it needs to be" warning. It's a common culprit for lower scores, and honestly, it can be a headache to track down. Recently, a really insightful discussion popped up in the Shopify community that dives deep into this very issue, specifically concerning product thumbnails in the popular Dawn theme. And let me tell you, it's a great example of how community collaboration can unravel complex problems.

The PageSpeed Puzzle: Oversized Thumbnails

The thread started with a user, @WetandDry, spotting a potential bug in Dawn (v15.5.0). They noticed that the sizes attribute for the product thumbnail strip in snippets/product-media-gallery.liquid seemed to be requesting images much larger than what was actually displayed on mobile. Specifically, the mobile fallback was using calc((100vw - 8rem) / 3), suggesting a 3-column layout, while they observed their thumbnails displaying 4-per-row. This discrepancy was causing the browser to download a ~533px image for a slot that only rendered at ~301px – a classic PageSpeed red flag!

WetandDry also pointed out that the image_tag calls within the thumbnail

    were requesting a maximum width: 416 with a widths array including 416. This too, they argued, was excessive for mobile thumbnails.

    Their proposed fix involved these specific changes:

    1. Changing the calc value:
      calc((100vw - 8rem) / 4)
      
      instead of the original:
      calc((100vw - 8rem) / 3)
      
    2. Reducing the maximum requested width for thumbnail images:
      image_url: width: 320
      
    3. And updating the widths attribute:
      widths: '54, 74, 104, 162, 208, 320'
      
      This would replace the original that included 416.

    Initially, @Mustafa_Ali chimed in, confirming it as a "solid find" and agreeing that the calc divisor might not have been updated when the grid changed, and that trimming the width array made sense.

    A Deeper Dive: The Community Uncovers Nuances

    However, this is where the community discussion really shone. Two other experts, @Vlad_Gerasimchuk and @lumine, dug into the stock Dawn v15.5.0 code and offered some critical counterpoints that are super important for anyone looking to implement this fix.

    Vlad and lumine independently verified the stock Dawn theme's CSS (specifically assets/section-main-product.css). They found that for mobile (@media screen and (max-width: 749px)), the thumbnail grid is indeed 3-across, not 4. The rule .thumbnail-list__item.slider__slide { width: calc(33% - 0.6rem); } clearly defines a 3-column layout. This means the original calc((100vw - 8rem) / 3) in snippets/product-media-gallery.liquid is actually correct for stock Dawn on mobile. Changing it to /4 would, surprisingly, make the requested image sizes too small for the displayed slots, potentially causing blurriness or further issues!

    They also clarified the purpose of the 416px widths. These aren't for mobile at all! On desktop (990px+), the grid expands to 4, 5, or even 6 columns. In these wider layouts, a single thumbnail slot can legitimately require a larger rendition. Trimming the 416px out of the widths array would actually lead to under-serving desktop thumbnails, which is definitely something we want to avoid for a crisp user experience on larger screens.

    So, where did the 533px warning come from if stock Dawn's thumbnails aren't requesting it?

    Both Vlad and lumine raised excellent questions about this 533px figure. It's not a standard width Dawn requests. They suggested a few possibilities:

    • Custom CSS changes: Has your store's CSS been modified to widen thumbnail slots or change the grid layout to 4-across on mobile? This is a very common scenario.
    • Wrong image: Is PageSpeed Insights pointing to the actual thumbnail image, or perhaps a different, larger image in the product gallery?
    • Device Pixel Ratio (DPR): Testing on a 2x or 3x retina screen can cause a browser to request a larger source image to maintain sharpness, even if the displayed dimensions are smaller.

    What This Means for Your Store: Actionable Steps

    This discussion highlights that while PageSpeed warnings are crucial, the fix isn't always a one-size-fits-all code snippet. Here's how you can approach this potential issue on your Shopify store:

    1. Verify Your Theme's Actual Mobile Thumbnail Layout

    Don't assume! Open your product page on a mobile device or use your browser's developer tools to simulate mobile viewports. Inspect the thumbnail elements. Look for the CSS rules applied to .thumbnail-list__item.slider__slide within assets/section-main-product.css. Specifically, check the @media screen and (max-width: 749px) block. Is it calc(33% - 0.6rem) (3-across) or something else?

    .thumbnail-list__item.slider__slide { width: calc(33% - 0.6rem); }
    

    If your CSS *does* show a 4-across rule on mobile, then your theme has been customized, and WetandDry's suggestion to change calc((100vw - 8rem) / 3) to calc((100vw - 8rem) / 4) in snippets/product-media-gallery.liquid might be relevant for your specific setup. However, remember to test thoroughly across different devices and desktop views to ensure you're not under-serving images elsewhere!

    2. Pinpoint the "Oversized" Image

    When PageSpeed Insights flags an image, click on the warning to see the exact URL of the image. Open that URL in your browser and check its width= parameter. Is it truly a thumbnail, or is it the main product image? This helps confirm if you're looking at the right element.

    3. Review Customizations

    If you've installed apps that modify theme files, or if you (or a developer) have manually edited snippets/product-media-gallery.liquid or assets/section-main-product.css, those changes are the most likely source of a mismatch between the requested and displayed image sizes. Compare your current files to a fresh download of the stock Dawn v15.5.0 theme to identify any differences.

    4. When to Report to Shopify Dawn GitHub

    If, and only if, you can reproduce this exact PageSpeed warning (533px image for a ~301px thumbnail slot) on a brand new, unedited installation of Dawn v15.5.0, then it's a legitimate bug in the theme. In this case, the best course of action is to open an issue on the Shopify Dawn GitHub repository. Theme fixes are typically handled there, not through forum posts.

    This entire thread is a fantastic reminder that optimizing for PageSpeed isn't just about applying quick fixes. It often requires a bit of detective work, understanding your theme's default behavior, and distinguishing between stock issues and custom code conflicts. Always test your changes thoroughly before deploying them to your live store!

Share:

Use cases

Explore use cases

Agencies, store owners, enterprise — find the migration path that fits.

Explore use cases