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:
Filippo Fontana 2024-03-17 12:19:31 +01:00 committed by zjedi
parent eeba87cc3d
commit 1dbb750bc0
2 changed files with 10 additions and 3 deletions

View file

@ -72,3 +72,10 @@ title = "Jane Doe - Nutrition Coach & Chef Consultant"
value = "mail@janedoe.com" value = "mail@janedoe.com"
url = "mailto:mail@janedoe.com" url = "mailto:mail@janedoe.com"
icon = "fa fa-envelope" icon = "fa fa-envelope"
# Add additional contacts here!
# [[params.contacts]]
# label = ""
# value = ""
# url = ""
# icon = ""

View file

@ -20,7 +20,7 @@
{{ if ne .Site.Params.footer.showContactIcons false }} {{ if ne .Site.Params.footer.showContactIcons false }}
<section class="icons"> <section class="icons">
{{ range .Site.Params.contacts }} {{ 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 }} {{ end }}
</section> </section>
{{ end }} {{ end }}