{# Render a single link element #} {% macro render_link(link, class="", grouped=false) %} {% set link_url = link.href | default(link.link | default("")) %} {% set link_text = link.text | default("") %} {% set link_icon = link.icon | default("") %} {% set link_description = link.description | default("") %} {% set link_kind = link.kind | default("") %} {% if not grouped %} {% if link_icon %} {% endif %} {% if link.image %} {% set img_src = link.image.src if link.image is mapping else link.image %} {% set img_width = link.image.width | default(link.image.size | default(20)) if link.image is mapping else 20 %} {% set img_height = link.image.height | default(link.image.size | default(20)) if link.image is mapping else 20 %} {% set img_class = link.image.class | default("d-inline-block") if link.image is mapping else "d-inline-block" %} {% set img_alt = link.image.alt | default(link_text) if link.image is mapping else link_text %} {{ img_alt }} {% endif %} {% if link_text %} {{ link_text }} {% endif %} {% else %}
{% if link_icon %} {% endif %} {% if link.image %} {% set img_src = link.image.src if link.image is mapping else link.image %} {% set img_width = link.image.width | default(link.image.size | default(20)) if link.image is mapping else 20 %} {% set img_height = link.image.height | default(link.image.size | default(20)) if link.image is mapping else 20 %} {% set img_class = link.image.class | default("d-inline-block") if link.image is mapping else "d-inline-block" %} {% set img_alt = link.image.alt | default(link_text) if link.image is mapping else link_text %} {{ img_alt }} {% endif %} {% if link_text %} {{ link_text }} {% endif %}
{% if link_kind %} {{ link_kind }} {% endif %}
{% if link_description %}
{{ link_description }}
{% endif %}
{% endif %} {% endmacro %}