html - Displaying images based upon certain collection -


I am trying to find an image to display a picture in which a collection is a special image. I am able to successfully display an image, but I am unable to reach the proper location of the image.

  {% if template == 'index'%} {% for% in collection%} and lieutenant; H2 & gt; {{Frontpage.title}} Collections & lt; / H2 & gt; {% If frontpage.image%} & lt; A href = "archive / {{frontpage.handle}}" & gt; & Lt; Img src = "{{frontpage.image.src | frontpage_img_url: 'medium'}}" /> & Lt; / A & gt; {% Else%} & lt; Img src = "{{frontpage.collections.first.featured_image | product_img_url: 'large'}}" alt = "{{frontpage.title | escape}}" /> {% Endif%} {% endfor%} {% else%} {% endif%}  

Image link as /collections/test-product.png I need to appear in the form of How can it be found to work?

Shopify gives an example on Wiki how to display a collection featured image :

  {% if collection.image%} {{collection.image.src | Collection_emg_arial: 'medium' | Img_tag: collection.title}} {% else%} {{collection.products.first.featured_image.src | Product_img_url: 'Medium' | | Img_tag: collection.title}} {% endif%}  

Also check the docs for this:

Returns the collection image Shopify on the CDN in the image file Use the filter to link.

and:

Returns the relative URL on the archive image.

Use store_mug_url in place of your code in place of frontpage_img_url .

You should also try frontpage.collections.first.featured_image instead of frontpage.products.first.featured_image.src .


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -