{% macro split_and_get(value, sep, index) %}
{%- if value.split is defined -%}
{%- set parts = value.split(sep) -%}
{%- else -%}
{%- set parts = value | split(sep) -%}
{%- endif -%}
{{- parts[index] -}}
{% endmacro %}
{% for social in config.extra.social %}
{% set rel = "noopener" %}
{% if "mastodon" in social.icon %}
{% set rel = rel ~ " me" %}
{% endif %}
{% set title = social.name %}
{% if not title and "//" in social.link %}
{% set url = split_and_get(social.link, "//", 1) %}
{% set title = split_and_get(url, "/", 0) %}
{% endif %}
{% include ".icons/" ~ social.icon ~ ".svg" %}
{% endfor %}