{% extends 'partials/base.html.twig' %}

{% set bodyclass = "categories" %}

{% block content %}

  <nav class="categories">
    {% include 'partials/tagslist.html.twig' with {'base_url':"/categories/", 'taxonomy':'tag', 'display':'inline'} %}
  </nav>

  {% set contents = page.collection %}
  {% set taxlist = taxonomylist.get() %}

  <div id="categories-content" class="grid">
    {% for tax,value in taxlist['client'] %}
      {% set posts = taxonomy.findTaxonomy({'client':tax}) %}

      {% set disposts = {} %}
      {% for p,v in posts %}
        {% if v in contents %}
          {% set disposts = disposts|merge({(p):v}) %}
        {% endif %}
      {% endfor %}

      {% if disposts|length %}
        <section class="client-block client-block-text grid-block columns large-3 medium-6 small-12">
          <h3>{{ tax }}</h3>
          <ul>
          {% for post in disposts %}
            <li class="project">
              {% include 'partials/projet-block.html.twig' with {'page':post,'display':'text'} %}
            </li>
          {% endfor %}
          </ul>
        </section>
      {% endif %}
    {% endfor %}
  </div>

{% endblock %}
