At all possible?
Or maybe, all pictures instead of zoom… link!?
Thank you for your time.
At all possible?
Or maybe, all pictures instead of zoom… link!?
Thank you for your time.
@LitExtension - @LitCommerce - @made4Uo - @Denishamakwana
THANK YOU
Hi @iwonder ,
Can you send me screenshots? I will check it.
Hi @iwonder ,
You are using Dawn theme, please send me the code of product-thumbnail.liquid file, I will help you to change it and add a link to it according to the alt of the image.
Thank you @LitCommerce
Start ------>
{% comment %}theme-check-disable ImgLazyLoading{% endcomment %}
{% comment %}
Renders a product thumbnail with a modal-opener
Accepts:
Usage:
{% render ‘product-thumbnail’,
media: media,
position: forloop.index,
loop: section.settings.enable_video_looping,
modal_id: section.id
%}
{% endcomment %}
{%- if media.media_type != ‘image’ -%}
{%- if media.media_type == ‘model’ -%}
{%- else -%}
{%- endif -%}
{%- if media.media_type == ‘model’ -%}
{{ ‘products.product.media.play_model’ | t }}
{%- render ‘icon-3d-model’ -%}
{%- else -%}
{{ ‘products.product.media.play_video’ | t }}
{%- render ‘icon-play’ -%}
{%- endif -%}
<img
srcset=“{% if media.preview_image.width >= 493 %}{{ media.preview_image | image_url: width: 493 }} 493w,{% endif %}
{% if media.preview_image.width >= 600 %}{{ media.preview_image | image_url: width: 600 }} 600w,{% endif %}
{% if media.preview_image.width >= 713 %}{{ media.preview_image | image_url: width: 713 }} 713w,{% endif %}
{% if media.preview_image.width >= 823 %}{{ media.preview_image | image_url: width: 823 }} 823w,{% endif %}
{% if media.preview_image.width >= 990 %}{{ media.preview_image | image_url: width: 990 }} 990w,{% endif %}
{% if media.preview_image.width >= 1100 %}{{ media.preview_image | image_url: width: 1100 }} 1100w,{% endif %}
{% if media.preview_image.width >= 1206 %}{{ media.preview_image | image_url: width: 1206 }} 1206w,{% endif %}
{% if media.preview_image.width >= 1346 %}{{ media.preview_image | image_url: width: 1346 }} 1346w,{% endif %}
{% if media.preview_image.width >= 1426 %}{{ media.preview_image | image_url: width: 1426 }} 1426w,{% endif %}
{% if media.preview_image.width >= 1646 %}{{ media.preview_image | image_url: width: 1646 }} 1646w,{% endif %}
{% if media.preview_image.width >= 1946 %}{{ media.preview_image | image_url: width: 1946 }} 1946w,{% endif %}
{{ media.preview_image | image_url }} {{ media.preview_image.width }}w”
src=“{{ media | image_url: width: 1946 }}”
sizes=“(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | times: media_width | round }}px, (min-width: 990px) calc({{ media_width | times: 100 }}vw - 10rem), (min-width: 750px) calc((100vw - 11.5rem) / 2), calc(100vw - 4rem)”
{% unless lazy_load == false %}loading=“lazy”{% endunless %}
width=“973”
height=“{{ 973 | divided_by: media.preview_image.aspect_ratio | ceil }}”
alt=“{{ media.preview_image.alt | escape }}”
{%- if media.media_type == ‘model’ -%}
{%- if xr_button -%}
<button
class=“button button–full-width product__xr-button”
type=“button”
aria-label=“{{ ‘products.product.xr_button_label’ | t }}”
data-shopify-xr
data-shopify-model3d-id=“{{ media.id }}”
data-shopify-title=“title”
data-shopify-xr-hidden
{% render ‘icon-3d-model’ %}
{{ ‘products.product.xr_button’ | t }}
{%- endif -%}
{%- else -%}
{%- endif -%}
{%- endif -%}
Thank you @LitCommerce
{% comment %}theme-check-disable ImgLazyLoading{% endcomment %}
{% comment %}
Renders a product thumbnail with a modal-opener
Accepts:
Usage:
{% render ‘product-thumbnail’,
media: media,
position: forloop.index,
loop: section.settings.enable_video_looping,
modal_id: section.id
%}
{% endcomment %}
{%- if media.media_type != ‘image’ -%}
{%- if media.media_type == ‘model’ -%}
{%- else -%}
{%- endif -%}
{%- if media.media_type == ‘model’ -%}
{{ ‘products.product.media.play_model’ | t }}
{%- render ‘icon-3d-model’ -%}
{%- else -%}
{{ ‘products.product.media.play_video’ | t }}
{%- render ‘icon-play’ -%}
{%- endif -%}
<img
srcset=“{% if media.preview_image.width >= 493 %}{{ media.preview_image | image_url: width: 493 }} 493w,{% endif %}
{% if media.preview_image.width >= 600 %}{{ media.preview_image | image_url: width: 600 }} 600w,{% endif %}
{% if media.preview_image.width >= 713 %}{{ media.preview_image | image_url: width: 713 }} 713w,{% endif %}
{% if media.preview_image.width >= 823 %}{{ media.preview_image | image_url: width: 823 }} 823w,{% endif %}
{% if media.preview_image.width >= 990 %}{{ media.preview_image | image_url: width: 990 }} 990w,{% endif %}
{% if media.preview_image.width >= 1100 %}{{ media.preview_image | image_url: width: 1100 }} 1100w,{% endif %}
{% if media.preview_image.width >= 1206 %}{{ media.preview_image | image_url: width: 1206 }} 1206w,{% endif %}
{% if media.preview_image.width >= 1346 %}{{ media.preview_image | image_url: width: 1346 }} 1346w,{% endif %}
{% if media.preview_image.width >= 1426 %}{{ media.preview_image | image_url: width: 1426 }} 1426w,{% endif %}
{% if media.preview_image.width >= 1646 %}{{ media.preview_image | image_url: width: 1646 }} 1646w,{% endif %}
{% if media.preview_image.width >= 1946 %}{{ media.preview_image | image_url: width: 1946 }} 1946w,{% endif %}
{{ media.preview_image | image_url }} {{ media.preview_image.width }}w”
src=“{{ media | image_url: width: 1946 }}”
sizes=“(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 100 | times: media_width | round }}px, (min-width: 990px) calc({{ media_width | times: 100 }}vw - 10rem), (min-width: 750px) calc((100vw - 11.5rem) / 2), calc(100vw - 4rem)”
{% unless lazy_load == false %}loading=“lazy”{% endunless %}
width=“973”
height=“{{ 973 | divided_by: media.preview_image.aspect_ratio | ceil }}”
alt=“{{ media.preview_image.alt | escape }}”
{%- if media.media_type == ‘model’ -%}
{%- if xr_button -%}
<button
class=“button button–full-width product__xr-button”
type=“button”
aria-label=“{{ ‘products.product.xr_button_label’ | t }}”
data-shopify-xr
data-shopify-model3d-id=“{{ media.id }}”
data-shopify-title=“title”
data-shopify-xr-hidden
{% render ‘icon-3d-model’ %}
{{ ‘products.product.xr_button’ | t }}
{%- endif -%}
{%- else -%}
{%- endif -%}
{%- endif -%}
Hi @iwonder ,
Please change all code:
{% comment %}theme-check-disable ImgLazyLoading{% endcomment %}
{% comment %}
Renders a product thumbnail with a modal-opener
Accepts:
- media: {Object} Product Media object
- position: {String} Position of the media. Used for accessible label.
- loop: {Boolean} Enable video looping (optional)
- modal_id: {String} The product modal that will be shown by clicking the thumbnail
- xr_button: {Boolean} Renders the "View in your space" button (shopify-xr-button) if the media is a 3D Model
- media_width: {Float} The width percentage that the media column occupies on desktop.
- lazy_load: {Boolean} Image should be lazy loaded. Default: true (optional)
Usage:
{% render 'product-thumbnail',
media: media,
position: forloop.index,
loop: section.settings.enable_video_looping,
modal_id: section.id
%}
{% endcomment %}
{%- liquid
case media.media_type
when 'video' or 'external_video'
render 'icon-play'
when 'model'
render 'icon-3d-model'
else
render 'icon-zoom'
endcase
-%}
{{ 'products.product.media.open_media' | t: index: position }}
{%- if media.media_type != 'image' -%}
{%- if media.media_type == 'model' -%}
{%- if xr_button -%}
{%- endif -%}
{%- else -%}
{%- endif -%}
{%- endif -%}
Then you just need to go to Products Admin and add link for image alt, it will work fine.
Refer https://help.shopify.com/en/manual/products/product-media/add-alt-text
Hope it helps!
Top!★★★★★ Thank you @LitCommerce
Do you think adding an Alt Text as a URL address will negatively impact the sites SEO?
Hi @iwonder ,
If you are afraid of affecting SEO, you just need to change the code here, the text you can change yourself, and everything will work fine
Hope it is clear to you.
Thank you @LitCommerce , I’m not sure, change the code as in delete “{{ media.preview_image.alt }}”? to alt=“Product Image”?
Hi @iwonder ,
Because you are afraid that changing the alt with the link will affect SEO, so you just need to change the alt display here, it will work without affecting SEO.
Hope it is clear to you.
Thank you @LitCommerce , would the image still be a link?
Hi @iwonder ,
Yes, the image is still linked, it just helps you fix the SEO according to what you were worried about.
Thank you for your time @LitCommerce , what does alt"Product image" do exactly? Does it pull the product image name?
Hi @iwonder ,
You can refer: https://www.w3schools.com/tags/att_img_alt.asp
Hope it is clear to you.