Custom collection list page not showing images properly, but almost works

Shopify Partner
6 0 0

Hey,

I have made some custom collection lists, made with a mix of what is in my theme and the below.

https://help.shopify.com/themes/customization/collections/featuring-collections-using-link-lists

I am having an issue. All of the items in the list that are collections are showing the image and work fine. I have two items in a list that are actually pages (which are also collection lists) I have it set up so that if there is an image in the content of the page it pulls that image. The issue I have, is it is not setting the image as the list item image in the main collection list. I am able to test that the right image is being pulled because I put a link below it that I called "link to image" and it goes to the right file.

Here is the code I have. It's a mash up between what I got above and the list-collection from my theme.

 {% assign linked_page = link.object %}                    
 {% if linked_page.content contains '<img' %}
          {% assign src = linked_page.content | split: 'src="' %}
          {% assign src = src[1] | split: '"' | first %}
          {% capture image_suffix %}{{ image_size }}{% endcapture %}
          {% assign src = src | replace: '_small', image_suffix | replace: '_compact', image_suffix | replace: '_medium', image_suffix | replace: '_large', image_suffix | replace: '_grande', image_suffix %}
 {% endif %} 

  {% assign link_image = src %}
  {% assign link_image_alt = link_title | escape %} 

  {% assign image = link_image %}
  {% assign image_alt = link_image_alt %}

<article class="collection--item" {% if block %}{{ block.shopify_attributes }}{% endif %}>
  <figure class="collection--item-image">
    <a href="{{ link_url }}">
   {% if image and image_alt %}
        {%
          include 'rimg',
          img: image,
          alt: image_alt,
          size: '1350x',
          lazy: true,
          canvas: true
        %}
      {% endif %}
    </a>
  </figure>

0 Likes
New Member
1 0 0

Sorry to dig this post up, but I'm having the same issue. 

Were you able to fix this?

Thank you

0 Likes