{% comment %}
  Collections are listed here.
{% endcomment %}

{% capture uses_minimal_framework %}{% include 'product-loop' %}{% endcapture %}

{% if uses_minimal_framework contains 'Liquid error' %}
  {% assign uses_minimal_framework = false %}
  {% assign grid_item_width = 'large--one-quarter large-up--one-quarter medium--one-third medium-up--one-third small--one-half large--col-3 medium--col-4 small--col-6' %}
{% else %}
  {% assign uses_minimal_framework = true %}
  {% assign grid_item_width = 'span3' %}
{% endif %}

{% assign image_size = 'large' %}

{% if linklists[collection.handle].links.size > 0 %}
    
  {% assign number_of_links = 0 %}
<div class="sectionWrap halfGutter hasGrid collection_page_bg">
  	{% if settings.sub_collection_title_show %}
    		<h1> {{ collection.title }} </h1>
  			
    	{% endif %}
	<div class="collectionGrid">
  	<div class="grid">
     {% if settings.sub_collection_description %}
  		<div class="fullSpan collection_desc"> {{ collection.description }} </div>
  	{% endif %}
    <ul class="flexGrid gridJustify centerColumns">
        {%assign row ='half'%}
        
        {% for link in linklists[collection.handle].links %}
           
      	  {% assign collection = link.object %}
          {%assign title = link.title%}
          

          {%if collection.image%}
            {%assign image = collection.image | img_url:'large'%}
          {%else%}
            {%assign image = collection.products.first | img_url:'large'%}
          {%endif%}
          {%unless collection.handle == 'frontpage'%}
      		
      		{%assign linkTmp = link.url%}
            {%include 'collection-thumb' with row %}
          {%endunless%}
        {%endfor%}
      </ul>
      </div>
</div>
  </div>
  

  

{% else %}

<div class="grid">
  <div class="grid__item grid-item rte text-center">
    <p>
      You do not have a link list with a handle set to <kbd>{{ page.handle }}</kbd>, or you do and it's empty. 
      Go ahead and create a link list called <b>{{ page.title }}</b> on your <a href="/admin/links" target="_blank">Navigation page</a> and populate that link list with links that point to collections, to see collections listed here.
      Make sure the link list also has a handle set to <kbd>{{ page.handle }}</kbd>.
    </p>
  </div>
</div>

{% endif %}

<style>
  kbd { 
    background-color: #FBFBE4;
    padding: 1px 4px;
    border-radius: 3px;
  }
</style>
