{%- set have_badges = user.gold or user.silver or user.bronze -%}
{%- if settings.KARMA_MODE != 'hidden' or (settings.BADGES_MODE == 'public' and have_badges) -%}
  {%- if settings.KARMA_MODE != 'hidden' -%}
  <a class="reputation"
    href="{{user.get_absolute_url()}}?sort=reputation"
    data-fetch-data-url="{{ url('get_perms_data') }}"
    data-url="{{ url('get_perms_data') }}"
  >{{ user.get_localized_profile().get_reputation() }}</a>
  {%- endif -%}
  {%- if settings.BADGES_MODE == 'public' and have_badges -%}
    <a class="badges" href="{{ user.get_absolute_url() }}#badges"
    ><span title="{{ user.get_badge_summary() }}">
        {% if user.gold %}
        <span class="with-gold-badge-icon">{{user.gold}}</span>
        {% endif %}
        {% if user.silver %}
        <span class="with-silver-badge-icon">{{user.silver}}</span>
        {% endif %}
        {% if user.bronze %}
        <span class="with-bronze-badge-icon">{{user.bronze}}</span>
        {%- endif -%}
    </span></a>
  {%- endif -%}
{%- endif -%}
