hugo-theme-lowtech/layouts/partials/contact/mail.html

13 lines
478 B
HTML

{{- $protocol := "mailto" -}}
{{- $mail := . -}}
{{- $mailWithProtocol := $mail -}}
{{- if strings.HasPrefix $mail $protocol -}}
{{- $mail = substr $mail 7 -}}
{{- else -}}
{{- $mailWithProtocol = print $protocol ":" $mail -}}
{{- end -}}
<a
class="mail obfuscate"
data-link="{{ range $index := seq (sub (len $mailWithProtocol) 1) 0}}{{ substr $mailWithProtocol $index 1}}{{ end }}"
>{{ range $index := seq (sub (len $mail) 1) 0}}{{ substr $mail $index 1}}{{ end }}</a>