Fix #173: tel: link is now handled correctly by Hugo
The `safeURL` function is required to insert URLs that are different than `http:`, `https:` and `mailto:` (e.g. `tel:`) through the Hugo templating system. Additionally, an example about how to add new contacts is added in the `config.toml` of `exampleSite`. Signed-off-by: Filippo Fontana <filippofontana1998@gmail.com>
This commit is contained in:
parent
eeba87cc3d
commit
1dbb750bc0
2 changed files with 10 additions and 3 deletions
|
|
@ -64,11 +64,18 @@ title = "Jane Doe - Nutrition Coach & Chef Consultant"
|
|||
[[params.contacts]]
|
||||
label = "phone"
|
||||
value = "+49 1111 555555"
|
||||
url = "tel: +49 1111 555555"
|
||||
url = "tel:+49 1111 555555"
|
||||
icon = "fa fa-phone"
|
||||
|
||||
[[params.contacts]]
|
||||
label = "email"
|
||||
value = "mail@janedoe.com"
|
||||
url = "mailto: mail@janedoe.com"
|
||||
url = "mailto:mail@janedoe.com"
|
||||
icon = "fa fa-envelope"
|
||||
|
||||
# Add additional contacts here!
|
||||
# [[params.contacts]]
|
||||
# label = ""
|
||||
# value = ""
|
||||
# url = ""
|
||||
# icon = ""
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
{{ if ne .Site.Params.footer.showContactIcons false }}
|
||||
<section class="icons">
|
||||
{{ range .Site.Params.contacts }}
|
||||
<a href="{{ .url }}" aria-label='{{ i18n "{{ .label }}" }}'><i class="{{ .icon }}"></i></a>
|
||||
<a href="{{ .url | safeURL }}" aria-label='{{ i18n "{{ .label }}" }}'><i class="{{ .icon }}"></i></a>
|
||||
{{ end }}
|
||||
</section>
|
||||
{{ end }}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue