{% if categories is defined and categories is not empty and categories|length > 0 %}
<div class="thematique-container dflex fwwrap mt-8px">
{% for category in categories %}
{% if category.id is defined and category.id is not empty %}
{% set id = category.id %}
{% else %}
{% set id = category %}
{% endif %}
{% set categoryEntity = load_category_by_id(id, app.request.locale) %}
{% if category.name is defined and category.name is not empty %}
{% set name = category.name %}
{% else %}
{% set name = categoryEntity.name %}
{% endif %}
{% set pageLink = categoryEntity.entity.pageLink %}
{% set contentLoad = sulu_content_load(pageLink.href).content %}
{% if pageLink is defined and pageLink is not empty and
contentLoad is defined and
contentLoad is not empty %}
<a href="{{ contentLoad.url }}" class="nodeco them-link">
{% endif %}
{% if id is defined and id is not empty %}
{% set color = categoryEntity.entity.color %}
<div class="thematiques-tag cwhite fw400 dflex aic" {% if color is defined and color is not empty %} style="background: {{ color }}" {% endif %}>
{{ name }}
</div>
{% endif %}
{% if pageLink is defined and pageLink is not empty and
contentLoad is defined and
contentLoad is not empty %}
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}