To address the issue of empty alt tags for collection images in Shopify's Dawn Theme, you'll need to make a few code modifications. This guide assumes you are working with the Dawn theme version 12.0.x. The process involves editing templates either within the Shopify admin or your local theme repository.
If you require assistance in incorporating this into your Dawn theme, we will be happy to include it at no extra cost when you purchase a pack of $10 worth of credits or more. Get in touch with us.
Updating Dawn Theme 12x
Access the Shopify admin area. Navigate to Sales Channels > Online Store and click "Customize."In the main navigation, look for a three-dot icon towards the upper left and click it to reveal the "Edit Code" link. Use the search function to find the templates that need modification.
This template addresses the empty alt text attribute on the collection image at the top of a Collection page.
Locate around Line 39 (Line 37 on older versions of Dawn Themes), where you'll see an empty alt tag (alt=""). Replace it with:
alt="{{ collection.image.alt }}"
Template 2: snippets/card-collection.liquid
This template fixes the blank alt text attribute on collection images wherever they appear in collection lists.
Find around line 53, where you'll see an empty alt tag (alt=""). Replace it with:
alt="{{ card_collection.featured_image.alt }}"
Once you've made these changes, save your template work and refresh the front end of your site. Visit a collection page or a collection list on your shop's page, right-click on a collection image to "inspect element," or view the source of the webpage. You should now see the alt text you entered in the Shopify admin. If you're using an SEO audit tool, remember to re-crawl your site to ensure the alt tag warnings have disappeared.