{% macro badges(item, mode, wrapper_classes='float-right ml-2 py-2') %}
    {%- set badge_ns = namespace(has_active_badges=False) %}
    {%- for badge in config.kerko_composer.get_ordered_specs('badges') %}
        {%- if badge.is_active(item) %}
            {%- set badge_ns.has_active_badges = True %}
        {%- endif %}
    {%- endfor %}
    {%- if badge_ns.has_active_badges %}
        <span class="{{ wrapper_classes }}">
            {%- for badge in config.kerko_composer.get_ordered_specs('badges') %}
                {{ badge.render(item, mode) }}
            {%- endfor %}
        </span>
    {%- endif %}
{% endmacro %}
