Help with Array Filters for Product Images

Solved
Tourist
3 0 2

site: https://www.customled.com

 

I'm working on the JSON-LD microdata for my product pages.  I'm having trouble automatically omitting product images that were created merely to pass video URL through the ALT tag.

 

Here is the image url loop in the JSON-LD microdata:

 

  {% for image in product.images %}   
    "{{ image.src | product_img_url: 'master' }}",
    {% endfor %}

Here is the output:

    "//cdn.shopify.com/s/files/1/0190/4226/products/15R1_WL-1000px-1_31419ae6-6d33-48f3-ae15-022131f0dc58.jpg?v=1578087870",       
       
    "//cdn.shopify.com/s/files/1/0190/4226/products/video_compact_7c93ef56-b892-451a-8c82-0bcf79dfe331.gif?v=1578087800",       
       
    "//cdn.shopify.com/s/files/1/0190/4226/products/15R1_WL-1000px-2_dbcb11cd-c675-4fb3-a25b-80053db4daae.jpg?v=1578087879",       
       
    "//cdn.shopify.com/s/files/1/0190/4226/products/15R1_SL-1000px-1_4714957e-0c69-4cca-a3aa-72660eee5ea2.jpg?v=1578087895",       
       
    "//cdn.shopify.com/s/files/1/0190/4226/products/15R1_SL-1000px-2-USA_4849ebdb-6f14-41e4-af92-9dbbb0271376.jpg?v=1578087914",       
       
    "//cdn.shopify.com/s/files/1/0190/4226/products/15R1_WL_SL-1000px-1_84a9d034-0e7f-4295-bf1b-c8663feac990.jpg?v=1578087926",

The second image is the one simply for passing the URL.  I believe they all contain "video_compact" in the url.  Can someone help me setup a filter that will automatically omit the image with this term in the URL?  I would appreciate it very much :)

 

Jon

 
0 Likes

Success.

Explorer
71 10 9
{% for image in product.images %} 
{% unless image.src contains 'video_compact' %} "{{ image.src | product_img_url: 'master' }}", {% endunless %} {% endfor %}

Please use above code

Still not satisfied!!! contact me
Is it good solution? Yes, please Like.
1 Like
Tourist
3 0 2

0 Likes