{% set taxlist = children_only is defined ? taxonomylist.getChildPagesTags() : taxonomylist.get() %}

{% macro pageLinkName(text) %}
  {{ text|lower|replace({' ':'_', 'é':'e'}) }}
{% endmacro %}

{% import _self as macro %}

{% for tax,value in taxlist[taxonomy] %}
  <ul>
    <span class="cat">{{ tax }}</span>

    {% set options = { items: {'@taxonomy': {'category': tax} } } %}
    {% set my_collection = page.collection(options) %}

    {% for i in my_collection %}
      {% if i.media.images|first %}
        <li class="{{i.parent.folder}}">
          <a id="{{i.parent.folder}}" href="{{i.url}}">{{i.title}}
            {% set images = i.media.images|slice(0,1) %}

            {% for image in images  %}
            {% set services_image = image.derivatives(320,1600,300).sizes('(max-width:26em) 100vw, 50vw').html(i.title) %}
              <div class="img">
                {{services_image}}
              </div>
            {% endfor %}
         </a>
          <span>-</span>
        </li>
        {% endif %}
    {% endfor %}
  </ul>
{% endfor %}
