Ad

Where Is An Image's "alt" Value Stored?

- 1 answer

In Shopify, when you assign an Image Alt Text to an image using the online editor, where is that value stored? Apparently, it is not stored in config/settings_data.json of the theme code.

Now I saw that my liquid code has

{{ block.settings.image | img_url: '580x', scale: 2 | img_tag: block.settings.image.alt, 'lazyload transition-in' }}

which means the alt tag value should come from settings, however that's not the case. It is stored somewhere, but I am not able to find in the theme code.

Ad

Answer

The alt attribute is stored internally for the object.

For example when you set a title for the product the title is not stored as a setting, but it's applied internally to that object.

In your example you have a block image, you target the image using block.settings.image and from there on you have access to all of the image properties seen in here https://help.shopify.com/themes/liquid/objects/image and ALT is one of them.

The file settings_data.json stores only information from settings_schema and all of the sections options.

Ad
source: stackoverflow.com
Ad