{{ with .Site.Params.social }}
<ul>
    {{ range sort . "weight" }}
    {{ if .icon }}
    <li>
        {{ if .email }}
        {{ $iconHTML := printf "<i class=\"%s\" aria-hidden=\"true\"></i>" .icon }}
        {{ partial "cloakemail" (dict "address" .email "protocol" "mailto" "display" $iconHTML) }}
        {{ else }}
        <a href="{{ .url | safeURL }}" aria-label="{{ .name }}" {{ if .rel }}rel="{{ .rel }}" {{ end }} {{ if .target
            }}target="{{ .target }}" {{ end }} {{ if .type }}type="{{ .type }}" {{ end }}>
            <i class="{{ .icon }}" aria-hidden="true"></i>
        </a>
        {{ end }}
    </li>
    {{ else }}
    <li>
        {{ if .email }}
        {{ partial "cloakemail" (dict "address" .email "protocol" "mailto" "display" .name) }}
        {{ else }}
        <a href="{{ .url | safeURL }}" aria-label="{{ .name }}" {{ if .rel }}rel="{{ .rel }}" {{ end }} {{ if .target
            }}target="{{ .target }}" {{ end }}>{{ .name }}</a>
        {{ end }}
    </li>
    {{ end }}
    {{ end }}
</ul>
{{ end }}