{% if categories is defined and categories is not empty and categories|length > 0 %}
<div class="thematique-container dflex fwwrap mt-8px mb-10px">
{% for category in categories %}
{% set this_category = load_category_by_id(category, 'fr') %}
{% if this_category.entity.pageLink.href is defined and this_category.entity.pageLink.href is not empty and sulu_content_load(this_category.entity.pageLink.href).content is defined and sulu_content_load(this_category.entity.pageLink.href).content['url'] is defined and sulu_resolve_category_parent_name(this_category.entity.key) == 'thematiques'%}
{% set page = sulu_content_load(this_category.entity.pageLink.href).content['url'] %}
{% endif %}
{% if this_category.entity.pageLink.href is defined and this_category.entity.pageLink.href is not empty and page is defined and page is not empty %}
<a href="{{ page }}" class="nodeco">
{% endif %}
{% if this_category.id is defined and this_category.id is not empty and sulu_resolve_category_parent_name(this_category.entity.key) == 'thematiques' %}
<div class="thematiques-tag cwhite fw500 dflex aic" style="background: {{this_category.entity.color}}">
{{this_category.entity.translations[0].translation}}
</div>
{% endif %}
{% if this_category.pageLink is defined and this_category.pageLink is not empty and page is defined and page is not empty and sulu_resolve_category_parent_name(this_category.entity.key) == 'thematiques' %}
</a>
{% endif %}
{% endfor %}
</div>
{% endif %}