对文本进行编码以保护电子邮件地址和电话号码不受垃圾邮件机器人的攻击。
成为我们的资助者或赞助商,以支持我们的工作。
| Module | github.com/hugomods/encoder |
|---|---|
| Stats |
encode 短代码encode 短代码语法1{{< encode [text] >}}
encode 短代码参数text| 索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
#0 | text | string | ✓ | - | - | - |
待编码的文本。
1{{< encode "user@example.org" >}}1{{< encode "123-12345678" >}}encode-link 短代码encode-link 短代码语法1{{< encode-link [protocol] [target] [text] >}}
encode-link 短代码参数protocol| 索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
#0 | protocol | string | ✓ | - | - | - |
链接协议,比如 mailto、tel。
target| 索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
#1 | target | string | ✓ | - | - | - |
链接目标,如邮箱地址([email protected])、电话号码(123-12345678)。
text| 索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
#0 | text | string | - | - | - | - |
链接文本,默认为 target。
*| 索引 | 名称 | 类型 | 必填 | 默认值 | 版本 | 示例 |
|---|---|---|---|---|---|---|
| - | * | string | - | - | - | - |
其他参数将作为链接属性,比如 class、rel。
encode-link 邮箱链接示例1{{< 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 电话号码示例1{{< 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 短代码encode-link 邮箱链接短代码的快捷方式,其无需指定 protocol 参数。
1{{< encode-email [target] [text] >}}
encode-tel 短代码encode-link 电话号码短代码的快捷方式,其无需指定 protocol 参数。
1{{< encode-tel [target] [text] >}}