{% load i18n dsfr_tags wagtailcore_tags wagtail_dsfr_tags %}
{% settings_value "WAGTAILADMIN_PATH" as admin_path %}
<div class="fr-mb-4w">
  <a class="fr-link {{ value.size }}{% if admin_path in value.url %} fr-icon-lock-line fr-link--icon-right{% elif value.document %} fr-link--download{% else %} {{ value.icon }}{% endif %}"
     href="{{ value.url }}"
     {% if value.url.0 != '/' and request.get_host not in value.url %}target="_blank" rel="noopener noreferrer"{% endif %}>
    {{ value.text }}
    {% if value.url.0 != '/' and request.get_host not in value.url %}
      <span class="fr-sr-only">{% translate "Opens a new window" %}</span>
    {% endif %}
    {% if value.document %}
      <span class="fr-link__detail">
        {% include "sites_conformes_content_manager/blocks/download_info.html" with document=value.document %}
      </span>
    {% endif %}
  </a>
</div>
