No Alt Text on Featured Collection- Dawn Theme

Solved
limelight91
Excursionist
39 1 2

Hi Everyone, 

 

Was checking my website SEO, and found that the alt text for my featured collections is missing, even though the images have alt text. How can I adjust the code so that the alt text is available on all pages with the featured collection?

Accepted Solution (1)
BoostStar
Shopify Partner
20 1 2

This is an accepted solution.

Hii @limelight91 Just add this code in theme.liquid at last.
<script>
 setTimeout(() => {
    document.querySelectorAll('img').forEach((image, index) => {
        if (!image.alt) image.alt = `{{ shop.name }} image--${index}`;
        if (index > 2) image.loading = 'lazy';
    })

  }, 2000);
</script>
Thank You
Regards
Team BoostStar.
Hope it helps. Let us know if you need further help with the issue.

Boost Star || Shopify Expert

 

We Are The Doctors, Make Shopify Sites Booster

View solution in original post

Replies 5 (5)
BoostStar
Shopify Partner
20 1 2

This is an accepted solution.

Hii @limelight91 Just add this code in theme.liquid at last.
<script>
 setTimeout(() => {
    document.querySelectorAll('img').forEach((image, index) => {
        if (!image.alt) image.alt = `{{ shop.name }} image--${index}`;
        if (index > 2) image.loading = 'lazy';
    })

  }, 2000);
</script>
Thank You
Regards
Team BoostStar.
Hope it helps. Let us know if you need further help with the issue.

Boost Star || Shopify Expert

 

We Are The Doctors, Make Shopify Sites Booster
oreoorbitz
Shopify Partner
229 27 126

@BoostStar 
This isn't a real solution as a blind person isn't going to appreciate alt text like the one that would result from that code.

Available for freelance. I specialize in speed improvement and theme development.
https://www.upwork.com/fl/orionholmes

If your looking for a pagespeed solution for your Website, take a look at: https://renderbetter.com/
BoostStar
Shopify Partner
20 1 2

Hi @oreoorbitz ,
if you want to add alt text without using code then you can update the alt text on products.
follow the steps
- go to product 
- open media
- and update the alt text from every images 

note - if images are not the part of products then you can pass alt attribute in <img> tag.
<img src="" alt=""> 

Thanks

We Are The Doctors, Make Shopify Sites Booster
silus
Shopify Partner
2 0 3

For future googlers:

In sections/main-collection-banner.liquid around line 37, change the

alt=""

to

alt="{{ collection.image.alt }}"

 

conifer
Tourist
6 0 7

Thanks. Unfortunately this didn't fix the issue for my shop.

 

It looks like we have yet another Shopify bug that we will need to fix by inserting custom code, thus preventing us from updating our theme version going forward.

 

Maybe an enterprising app developer will create an app for this and get a recurring revenue stream as a reward for helping people work around another Shopify bug.

 

This platform is broken. If any shopify devs are listening, please prioritize bug fixes like this and stop relying on your partners to clean up your mess.