2014-12-08 55 views
0

我在shopify帳戶中有不同的圖像,每個圖像都有自己的alt標籤。我想讓每個圖像下都顯示單獨的alt標籤。如果我使用{{image.alt | escape}},它只顯示所有變體圖像的一個替代名稱。因此,如果圖像01有「alt 01」,圖像02有「alt 02」,並且我嘗試在頁面上顯示它們,則都會顯示「alt 01」。任何關於利用圖像alt字段的東西?Shopify顯示每個Variant的Alt圖像

{% for image in product.images %} 
    <li data-thumb="{{ image | product_img_url: 'large' }}" data-title="{{ image.alt | escape }}"> 
     <a href="{{ image | product_img_url: '1024x1024' }}" class="fancybox" rel="group" title="{{ image.alt | escape }}"> 
     <img src="{{ image | product_img_url: 'large' }}" alt="{{ image.alt | escape }}" itemprop="image" data-cloudzoom="zoomImage: '{{ image | product_img_url: '1024x1024' }}', tintColor: '{{ settings.shop_bg_color }}'" class="cloudzoom" /><br /> 
     {{ image.alt | escape }} 
     </a> 
    </li> 
    {% endfor %} 
+0

我們有同樣的問題,解決這個問題有什麼好運? – 2017-02-15 15:46:26

回答

1

確保您已爲管理員的產品頁面中的每個圖像提供了alt標記。

See here

variant images screenshot

我測試你的代碼,當ALT標記沒有設置輸出每個圖像下的產品稱號。在爲每個圖像輸入替代文本(從管理區域的產品頁面)後,您的代碼段按預期工作,並在每個產品圖像下輸出相應的替代標記。

相關問題