You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
782 B
HTML

{{ $class := .Get 0 | default (.Get "class") }}
{{ $name := .Get "name" }}
{{ $url := .Get "url" }}
{{ if not $class }}
{{ errorf "layouts/shortcodes/paige/icon.html: no class" }}
{{ end }}
<span class="paige-icon">
{{ with $url -}}
{{- if hasPrefix . "mailto:" -}}
<a href="#" data-a="{{ base64Encode (index (split . `@`) 0) }}" data-b="{{ base64Encode `@` }}" data-c="{{ base64Encode (index (split . `@`) 1) }}" onclick="this.href = atob(this.dataset.a) + atob(this.dataset.b) + atob(this.dataset.c)">
{{- else -}}
<a href="{{ . }}">
{{- end -}}
{{- end -}}
<i class="{{ $class }}">{{ with $name }}<span class="visually-hidden">{{ . }}</span>{{ end }}</i>
{{- if $url -}}
</a>
{{- end }}
</span>