Alt text of Images not being shown in the collection page!!

We have added alt texts to all our product images but when these products are featured in any collection, the alt texts are not being picked up. I think this is not helping me with SEO.

I would really appreciate someone guiding me how to go about this.

Thanks in advance.

PLease provide website url and if your store is password protected then also provide password

Hi @Hardik29418 ,

Thanks for the prompt reply.

Can you guide me where to paste this code in product.liquid

alt=“{{ product.featured_image.alt | escape }}”

<img src=“{{ product.featured_image | img_url: ‘2000x’ }}” alt=“{{ product.featured_image.alt | escape }}” />

1 Like

Hi @Hardik29418

Really appreciate your quick reply.

The following is the code for my product-template.liquid file. I cant find where to put the code.

Can you guide me?

Thanks for your patience

{% comment %}
** Product - default view **

  • Product template
    {% endcomment %}

{% if collection.previous_product or collection.next_product or section.settings.product_breadcrumb %}
{% if collection.previous_product or collection.next_product %}
{% if collection.previous_product %} {{ 'products.general.previous_product_html' | t }} {% endif %} {% if collection.previous_product and collection.next_product %} | {% endif %}

{% if collection.next_product %}
{{ ‘products.general.next_product_html’ | t }}
{% endif %}

{% endif %}

{% if section.settings.product_breadcrumb %}

{% endif %}
{% endif %}

{% comment %}Check to see if sidebar should be enabled{% endcomment %}
{% if section.blocks.size > 0 %}
{% assign sidebar = true %}
{% else %}
{% assign sidebar = false %}
{% endif %}

{% if sidebar %} {% include 'sidebar' %}
{% else %}
{% endif %}
{% include 'product-images' %}

{% assign collection_handles = product.collections | map: ‘handle’ %}
{% assign variant = product.selected_or_first_available_variant %}

{% if product.available %}

{% comment%}
{% if settings.sale_banner_enabled and product.compare_at_price_max > product.price %}

{{ 'collections.general.sale' | t }}
{% endif %} {% endcomment %}

{% assign product_tags = product.tags | join: ’ ’ %}
{% if product_tags contains ‘sale’ %}

{{ 'collections.general.sale' | t }}
{% endif %}

{% endif %}
{% if collection_handles contains ‘new’ %}

{{ 'collections.general.new' | t }}
{% endif %} {% if collection_handles contains 'pre-order' %}
{{ 'collections.general.pre_order' | t }}
{% endif %}

{% if section.settings.display_vendor %}

{{ product.vendor | link_to_vendor }}

{% endif %}

{% if variant.sku != blank and section.settings.display_sku %}

{{ variant.sku }}

{% endif %}

{% assign titleSplit = product.title | split: " | " %}

{{ titleSplit[0] }}{{ titleSplit[1] }} {{ titleSplit[2] }}

{% if section.settings.enable_shopify_product_badges and settings.enable_shopify_review_comments %} {% endif %}

{% assign product_tags = product.tags | join: ’ ’ %}
{% if product_tags contains ‘meta-size-chart-’ %}
{% for tag in product.tags %}
{% if tag contains ‘meta-size-chart-’ %}
{{ ‘products.product.size_chart’ | t }}
{% include ‘popup-size-chart’, product_id: product.id %}
{% endif %}
{% endfor %}
{% elsif settings.size_chart != blank %}
{{ ‘products.product.size_chart’ | t }}
{% endif %}

{% if collection_handles contains ‘coming-soon’ %}

{{ 'collections.general.coming_soon' | t }}

{% else %}

{% comment %}{% if variant.available == false %}{{ ‘products.product.sold_out’ | t }}{% endif %}{% endcomment %}


<span itemprop=“price” content=“{{ variant.price | money_without_currency | remove: “,” }}” class=“{% if variant.compare_at_price > variant.price %}sale{% endif %}”>

{% if variant.price > 0 %}
{{ variant.price | money }}
{% else %}
{{ settings.free_price_text }}
{% endif %}



{% if variant.price < variant.compare_at_price and variant.available %}
{{ variant.compare_at_price | money }}
{% endif %}

{% if section.settings.display_savings %}

{% if variant.price < variant.compare_at_price and variant.available %}
{{ ‘products.product.savings’ | t }} {{ variant.compare_at_price | minus: variant.price | times: 100 | divided_by: variant.compare_at_price }}% ({{ variant.compare_at_price | minus: variant.price | money }})
{% endif %}

{% endif %}

{% include ‘product-notify-me’ %}
{% endif %}

{% if section.settings.product_description_position == “top” %}
{% if product.description != blank %}

{% if product.description contains '' %}{{ product.description | split: '' | first }}{% else %}{% include 'product-description-tabs' %}{% endif %}
{% endif %} {% endif %}

{% if collection_handles contains “engagement-rings” %}

    {% if product.metafields["global"]["Metal"] %}
  • Metal: {{ product.metafields["global"]["Metal"] }}
  • {% endif %} {% if product.metafields["global"]["Shape"] %}
  • Shape: {{ product.metafields["global"]["Shape"] }}
  • {% endif %} {% if product.metafields["global"]["Colour"] %}
  • Colour: {{ product.metafields["global"]["Colour"] }}
  • {% endif %} {% if product.metafields["global"]["Clarity"] %}
  • Clarity: {{ product.metafields["global"]["Clarity"] }}
  • {% endif %}

    {% comment %}
    {% if product.metafields[“global”][“Carat”] %}

  • Carat: {{ product.metafields[“global”][“Carat”] }}
  • {% endif %}
    {% endcomment %}

    {% if product.metafields[“global”][“Centre-Diamond-Weight”] %}

  • Centre Diamond Weight: {{ product.metafields[“global”][“Centre-Diamond-Weight”] }}
  • {% endif %}
    {% if product.metafields[“global”][“Total-Carat-Weight”] %}
  • Total Diamond Weight: {{ product.metafields[“global”][“Total-Carat-Weight”] }}
  • {% endif %}

    {% if product.metafields[“global”][“Certification”] %}

  • Certificate: {{ product.metafields[“global”][“Certification”] }}
  • {% endif %}
    {% if product.metafields[“global”][“Diamond”] %}
  • Diamond: {{ product.metafields[“global”][“Diamond”] }}
  • {% endif %}

{% endif %}

{% unless collection_handles contains ‘coming-soon’ %}
{% include ‘product-form’ with ‘product’ %}
{% endunless %}

{% if section.settings.product_description_position == “bottom” %}
{% if product.description != blank %}

{% if product.description contains '' %}{{ product.description | split: '' | first }}{% else %}{% include 'product-description-tabs' %}{% endif %}
{% endif %} {% endif %}

{% if section.settings.review_position == “next_to_gallery” %}

{{ product.metafields.spr.reviews }}
{% endif %}

{% if section.settings.display_collections or section.settings.display_tags or section.settings.display_type %}

{% if section.settings.display_collections %}

{{ 'products.product.collections' | t }}: {% for col in product.collections %} {{ col.title }}{% unless forloop.last %},{% endunless %} {% endfor %}

{% endif %}

{% if section.settings.display_type %}

{{ 'products.product.product_types' | t }}: {{ product.type | link_to_type }}

{% endif %}

{% if section.settings.display_tags %}

{% for tag in product.tags %} {% if forloop.first %} {{ 'products.product.tags' | t }}: {% endif %}

{% unless tag contains ‘meta-’ %}

{{ tag }}{% unless forloop.last %},{% endunless %}

{% endunless %}
{% endfor %}

{% endif %}
{% endif %}
{% if section.settings.display_social_buttons %} {% include "social-buttons" with "product" %} {% endif %}

{% if product.description contains “” %}

{% capture desctabs %}{{ product.description | split: '' | last }}{% endcapture %}{% include 'product-description-tabs' with desctabs %}
{% endif %}

{% if section.settings.review_position == “below_gallery” %}

{{ product.metafields.spr.reviews }}
{% endif %}

{% if sidebar %}

{% if section.settings.display_related_products %}
{% include ‘include-related-products’ %}
{% endif %}
{% if section.settings.display_recently_viewed %}
{% include ‘include-recently-viewed’ %}
{% endif %}

{% else %}

{% if section.settings.display_related_products %}
{% include ‘include-related-products’ %}
{% endif %}
{% if section.settings.display_recently_viewed %}
{% include ‘include-recently-viewed’ %}
{% endif %}

{% endif %}

{% schema %}

{
“name”: “Product”,
“class”: “product-template”,
“settings”: [
{
“type”: “checkbox”,
“id”: “product_breadcrumb”,
“label”: “Show breadcrumb links”
},
{
“type”: “checkbox”,
“id”: “display_vendor”,
“label”: “Show vendor”
},
{
“type”: “checkbox”,
“id”: “display_sku”,
“label”: “Show SKU”
},
{
“type”: “checkbox”,
“id”: “display_savings”,
“label”: “Show price savings”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “display_collections”,
“label”: “Show collections”
},
{
“type”: “checkbox”,
“id”: “display_type”,
“label”: “Show type”
},
{
“type”: “checkbox”,
“id”: “display_tags”,
“label”: “Show tags”
},
{
“type”: “checkbox”,
“id”: “display_social_buttons”,
“label”: “Show social media share icons”,
“default”: true
},
{
“type”: “radio”,
“id”: “product_description_position”,
“label”: “Description position”,
“options”: [
{
“value”: “top”,
“label”: “Above product form”
},
{
“value”: “bottom”,
“label”: “Below product form”
}
]
},
{
“type”: “header”,
“content”: “Product gallery”
},
{
“type”: “checkbox”,
“id”: “gallery_arrows”,
“label”: “Show arrows on product gallery”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “activate_zoom”,
“label”: “Magnify product images on hover”
},
{
“type”: “checkbox”,
“id”: “enable_product_lightbox”,
“label”: “Enable product gallery popup”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “activate_autoplay”,
“label”: “Enable product gallery slideshow”
},
{
“type”: “select”,
“id”: “slideshow_animation”,
“label”: “Gallery transition”,
“options”: [
{
“value”: “slide”,
“label”: “Slide”
},
{
“value”: “fade”,
“label”: “Fade”
}
],
“default”: “slide”
},
{
“type”: “radio”,
“id”: “product_images_position”,
“label”: “Gallery position”,
“options”: [
{
“value”: “left”,
“label”: “Left”
},
{
“value”: “right”,
“label”: “Right”
}
]
},
{
“type”: “checkbox”,
“id”: “product_thumbs”,
“label”: “Show product gallery thumbnails”,
“default”: true
},
{
“type”: “select”,
“id”: “thumbnail_position”,
“label”: “Thumbnail position”,
“default”: “bottom-slider”,
“options”: [
{
“value”: “bottom-thumbnails”,
“label”: “Bottom (grid)”
},
{
“value”: “bottom-slider”,
“label”: “Bottom (slider)”
},
{
“value”: “left-thumbnails”,
“label”: “Left”
},
{
“value”: “right-thumbnails”,
“label”: “Right”
}
]
},
{
“type”: “header”,
“content”: “Product reviews”
},
{
“type”: “paragraph”,
“content”: “Reviews app must be enabled. Learn more
},
{
“type”: “checkbox”,
“id”: “enable_shopify_product_badges”,
“label”: “Display star rating on product”,
“default”: false
},
{
“type”: “radio”,
“id”: “review_position”,
“label”: “Reviews position”,
“default”: “next_to_gallery”,
“options”: [
{
“value”: “next_to_gallery”,
“label”: “In product description area”
},
{
“value”: “below_gallery”,
“label”: “Below image/description”
}
]
},
{
“type”: “header”,
“content”: “Dynamic checkout button”
},
{
“type”: “paragraph”,
“content”: “Lets customers check out directly using a familiar payment method. Learn more
},
{
“type”: “checkbox”,
“id”: “show_payment_button”,
“label”: “Show dynamic checkout button”,
“default”: true
},
{
“type”: “header”,
“content”: “Related products”
},
{
“type”: “checkbox”,
“id”: “display_related_products”,
“label”: “Show related products”,
“info”: “Learn more”,
“default”: true
},
{
“type”: “radio”,
“id”: “related_products_style”,
“label”: “Layout”,
“default”: “grid”,
“options”: [
{
“value”: “slider”,
“label”: “Slider”
},
{
“value”: “grid”,
“label”: “Grid”
}
]
},
{
“type”: “range”,
“id”: “related_products_limit”,
“label”: “Limit products”,
“min”: 3,
“max”: 50,
“step”: 1,
“default”: 12
},
{
“type”: “range”,
“id”: “products_per”,
“label”: “Products per row”,
“min”: 3,
“max”: 5,
“step”: 1,
“default”: 3
},
{
“type”: “header”,
“content”: “Recently viewed products”
},
{
“type”: “paragraph”,
“content”: “To test the recently viewed products, view your online store outside of the Editor and visit multiple product pages. Learn more
},
{
“type”: “checkbox”,
“id”: “display_recently_viewed”,
“label”: “Show recently viewed products”,
“default”: false
},
{
“type”: “text”,
“id”: “rv_title”,
“label”: “Title”,
“default”: “Recently Viewed Items”
},
{
“type”: “radio”,
“id”: “rv_products_style”,
“label”: “Layout”,
“default”: “grid”,
“options”: [
{
“value”: “slider”,
“label”: “Slider”
},
{
“value”: “grid”,
“label”: “Grid”
}
]
},
{
“type”: “range”,
“id”: “rv_max_display”,
“label”: “Products limit”,
“min”: 3,
“max”: 12,
“step”: 1,
“default”: 4
},
{
“type”: “range”,
“id”: “rv_per”,
“label”: “Products per row”,
“min”: 3,
“max”: 5,
“step”: 1,
“default”: 4
},
{
“type”: “header”,
“content”: “Sidebar”
},
{
“type”: “paragraph”,
“content”: “Create a sidebar by adding content blocks.”
},
{
“type”: “checkbox”,
“id”: “toggle”,
“label”: “Toggle sidebar content”,
“default”: false
}
],
“blocks”: [
{
“type”: “filter_by_collection”,
“name”: “Collection list”,
“limit”: 1
},
{
“type”: “menu”,
“name”: “Menu”,
“settings”: [
{
“type”: “link_list”,
“id”: “custom_menu_linklist”,
“label”: “Menu”
}
]
},
{
“type”: “page”,
“name”: “Page”,
“settings”: [
{
“type”: “page”,
“id”: “content_page”,
“label”: “Page”
}
]
},
{
“type”: “recently_viewed”,
“name”: “Recently viewed products”,
“limit”: 1,
“settings”: [
{
“type”: “paragraph”,
“content”: “To test the recently viewed products, view your online store outside of the Editor and visit multiple product pages. Learn more
},
{
“type”: “text”,
“id”: “sidebar_rv_title”,
“label”: “Title”,
“default”: “Recently Viewed”
},
{
“type”: “range”,
“id”: “sidebar_rv_per”,
“label”: “Products limit”,
“min”: 1,
“max”: 4,
“step”: 1,
“default”: 3
}
]
},
{
“type”: “filter_by_tag”,
“name”: “Tag list”,
“limit”: 1
},
{
“type”: “text”,
“name”: “Text”,
“settings”: [
{
“type”: “text”,
“id”: “title”,
“label”: “Heading”,
“default”: “Heading”
},
{
“type”: “richtext”,
“id”: “text”,
“label”: “Text”,
“default”: “

Text area can be used for special announcements or general information.


}
]
},
{
“type”: “filter_by_type”,
“name”: “Type list”,
“limit”: 1
},
{
“type”: “filter_by_vendor”,
“name”: “Vendor list”,
“limit”: 1
}
],
“default”: {
“settings”: {

}
}
}

{% endschema %}

Please go in product-images.liquid snippet and send me that code

1 Like

Hi @Hardik29418

The following is the code for product-images.liquid snippet.

Please have a look

{% assign featured_image = product.selected_or_first_available_variant.featured_image | default: product.featured_image %}
{% capture list %}
{% for image in product.images %}
{% comment %}Loop through images only once{% endcomment %}
{{ image.id }}~{{ image.alt }}~{{ image | product_img_url: ‘100x’ }}~{{ image | product_img_url: ‘200x’ }}~{{ image | product_img_url: ‘400x’ }}~{{ image | product_img_url: ‘600x’ }}~{{ image | product_img_url: ‘800x’ }}~{{ image | product_img_url: ‘1200x’ }}~{{ image | product_img_url: ‘2000x’ }}~{{-image.width-}}px~{{-image.height-}}px{{ image | product_img_url: ‘5000x’ }}{% if forloop.last == false %}^{% endif %}
{% endfor %}
{% endcapture %}
{% assign image_list = list | split: “^” %}

{% for image_item in image_list %}
{% assign image = image_item | split: “~” %}
{% capture image_id %}{{ image[0] | strip }}{% endcapture %}
{% capture image_alt %}{{ image[1] | strip }}{% endcapture %}
{% capture image_100x %}{{ image[2] }}{% endcapture %}
{% capture image_200x %}{{ image[3] }}{% endcapture %}
{% capture image_400x %}{{ image[4] }}{% endcapture %}
{% capture image_600x %}{{ image[5] }}{% endcapture %}
{% capture image_800x %}{{ image[6] }}{% endcapture %}
{% capture image_1200x %}{{ image[7] }}{% endcapture %}
{% capture image_2000x %}{{ image[8] }}{% endcapture %}
{% capture image_5000x %}{{ image[8] }}{% endcapture %}
{% capture original_image_width %}{{- image[9] -}}{% endcapture %}
{% capture original_image_height %}{{- image[10] -}}{% endcapture %}

{% if image_alt contains ‘youtube’ or image_alt contains ‘vimeo’ %}
{% assign lazyframesrc=image_alt | split: ‘src="’ %}
{% assign lazyframesrc=lazyframesrc[1] | split: ‘"’ | first %}
{% endif %}

{% if image_alt contains 'youtube' or image_alt contains 'vimeo' %} {% assign src=image_alt | split: 'src="' %} {% assign src=src[1] | split: '"' | first %}

{% if src contains ‘?’ %}
{% assign src=src | append: ‘&autoplay=1&rel=0’ %}
{% else %}
{% assign src=src | append: ‘?autoplay=1&rel=0’ %}
{% endif %}

{% else %} {% if section.settings.enable_product_lightbox %} {% endif %} {% if image_width == 'full' %}
{{ image_alt | escape }}
{% else %}
{{ image_alt | escape }}
{% endif %} {% if section.settings.enable_product_lightbox %}
{% endif %} {% endif %}
{% endfor %}
{% if section.settings.product_thumbs %} {% if product.images.size > 1 and image_width != 'full' %}

{% for image_item in image_list %}
{% assign image = image_item | split: “~” %}
{% capture image_id %}{{ image[0] | strip }}{% endcapture %}
{% capture image_alt %}{{ image[1] | strip }}{% endcapture %}
{% capture image_100x %}{{ image[2] }}{% endcapture %}
{% capture image_200x %}{{ image[3] }}{% endcapture %}
{% capture image_400x %}{{ image[4] }}{% endcapture %}
{% capture image_600x %}{{ image[5] }}{% endcapture %}
{% capture image_800x %}{{ image[6] }}{% endcapture %}
{% capture image_1200x %}{{ image[7] }}{% endcapture %}
{% capture image_2000x %}{{ image[8] }}{% endcapture %}

{{ image_alt | escape }}
{% endfor %}
{% endif %} {% endif %}

@Hardik29418 Any luck??

Waiting for your response.

it seems that I have to enter into your store to fix it. can you please give me restricted access of your store? please DM

1 Like

@Hardik29418 I wont be able to give you access of the store as I dont have those permissions myself.

I appreciate you being very patient with me.

Is there any other way you could guide me? Like through anydesk or teamviewer?

yes I can.Please Dm your anydesk number

1 - Go to Snippets folder and open the card-collection.liquid

2 - Ctrl+F to open the Find Field and look for “alt” ( to find the empty alt=‘’" )

3 - Replace this in your empty Alt >> alt=“{{ card_collection.featured_image.alt | escape }}”

---------------- That’s the

where I found mine ---------------------------------

<img srcset="{%- if card_collection.featured_image.width >= 165 -%}{{ card_collection.featured_image | image_url: width: 165 }} 165w,{%- endif -%} {%- if card_collection.featured_image.width >= 330 -%}{{ card_collection.featured_image | image_url: width: 330 }} 330w,{%- endif -%} {%- if card_collection.featured_image.width >= 535 -%}{{ card_collection.featured_image | image_url: width: 535 }} 535w,{%- endif -%} {%- if card_collection.featured_image.width >= 750 -%}{{ card_collection.featured_image | image_url: width: 750 }} 750w,{%- endif -%} {%- if card_collection.featured_image.width >= 1000 -%}{{ card_collection.featured_image | image_url: width: 1000 }} 1000w,{%- endif -%} {%- if card_collection.featured_image.width >= 1500 -%}{{ card_collection.featured_image | image_url: width: 1500 }} 1500w,{%- endif -%} {%- if card_collection.featured_image.width >= 3000 -%}{{ card_collection.featured_image | image_url: width: 3000 }} 3000w,{%- endif -%} {{ card_collection.featured_image | image_url }} {{ card_collection.featured_image.width }}w" src="{{ card_collection.featured_image | image_url: width: 1500 }}" sizes=" (min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | divided_by: columns }}px, (min-width: 750px) {% if columns > 1 %}calc((100vw - 10rem) / 2){% else %}calc(100vw - 10rem){% endif %}, calc(100vw - 3rem)" **alt="{{ card_collection.featured_image.alt | escape }}"** height="{{ card_collection.featured_image.height }}" width="{{ card_collection.featured_image.width }}" loading="lazy" class="motion-reduce" >

Please let me know if it worked.