-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add email-protect shortcode with configurable email and link text
- Loading branch information
Showing
2 changed files
with
7 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,4 +210,4 @@ special interests. | |
You can [donate via credit card or cryptocurrency](/donate), or donate through our [Ghost Key](/ghostkey/) | ||
mechanism to establish a verifiable cryptographic identity. | ||
|
||
If you are in a position to make a larger contribution or grant please email Ian at {{< email-protect >}}. | ||
If you are in a position to make a larger contribution or grant please email Ian at {{< email-protect "[email protected]" "Ian Clarke" >}}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{{ $id := now.UnixNano }}<script>(function(){ | ||
const encoded = "[email protected]"; | ||
{{ $email := .Get 0 }} | ||
{{ $text := .Get 1 | default $email }} | ||
{{ $encoded := $email | strings.ToLower | strings.Rot13 }} | ||
<script>(function(){ | ||
const decode = str => str.replace(/[a-zA-Z]/g, c => | ||
String.fromCharCode((c <= 'Z' ? 90 : 122) >= (c = c.charCodeAt(0) + 13) ? c : c - 26) | ||
); | ||
const email = decode(encoded); | ||
document.write(`<a href="mailto:${email}">${email}</a>`); | ||
const email = decode("{{ $encoded }}"); | ||
document.write(`<a href="mailto:${email}">${decode("{{ $text | strings.Rot13 }}")}</a>`); | ||
})();</script> |