Encode text to protect email address and telephone number from spam bots.
Become a backer or sponsor to support our work.
| Module | github.com/hugomods/encoder |
|---|---|
| Stats |
encode Shortcodeencode Shortcode Syntax1{{< encode [text] >}}
encode Shortcode Parameterstext| Position | Name | Type | Required | Default | Since | Example |
|---|---|---|---|---|---|---|
#0 | text | string | ✓ | - | - | - |
The text to be encoded.
1{{< encode "user@example.org" >}}1{{< encode "123-12345678" >}}encode-link Shortcodeencode-link Shortcode Syntax1{{< encode-link [protocol] [target] [text] >}}
encode-link Shortcode Parametersprotocol| Position | Name | Type | Required | Default | Since | Example |
|---|---|---|---|---|---|---|
#0 | protocol | string | ✓ | - | - | - |
The link protocol, e.g. mailto, tel.
target| Position | Name | Type | Required | Default | Since | Example |
|---|---|---|---|---|---|---|
#1 | target | string | ✓ | - | - | - |
The target of link, such as email address (user@example.org), telephone number (123-12345678).
text| Position | Name | Type | Required | Default | Since | Example |
|---|---|---|---|---|---|---|
#0 | text | string | - | - | - | - |
The link text, default to the target.
*| Position | Name | Type | Required | Default | Since | Example |
|---|---|---|---|---|---|---|
| - | * | string | - | - | - | - |
Others parameter will be treated as the link attributes, such as class, rel.
encode-link Email Examples1{{< encode-link "mailto" "user@example.org" >}}
2
3{{< encode-link protocol="mailto" target="user@example.org" text="Send me an email." >}}
4
5{{< encode-link protocol="mailto" target="user@example.org" text="Send me an email." class="text-success" >}}encode-link Telephone Number Examples1{{< encode-link "tel" "123-1234567" >}}
2
3{{< encode-link protocol="tel" target="123-12345678" text="Call me." >}}
4
5{{< encode-link protocol="tel" target="123-12345678" text="Call me." class="text-success" >}}encode-email ShortcodeA shorthand of encode-link for email address that without requirements of specifying the protocol parameter.
1{{< encode-email [target] [text] >}}
encode-tel ShortcodeA shorthand of encode-link for telephone number that without requirements of specifying the protocol parameter.
1{{< encode-tel [target] [text] >}}