# the output html
<a href="tel:17043521">17043521</a>
cannot understand why it change the random given number in params.yaml file to something else
0000000000 = 0
0101010101 = 17043521
it only change few numbers not all which made me really confused in some places where I am giving example to the users like use the phone format 000 000 0000 etc to show only 0
if I add the | safeHTML in layouts it still show the same weird number
If you use the numbers in string format with double quote wrapping, you should be fine… but then don’t try to convert that string to int in the template using int otherwise it will once again be converted to Octal.
thanks @kaushalmodi for sharing the int issue I was trying to understand how to make use of {{ int ("0987" | strings.TrimLeft "0") }} to remove 0 when showing international format
the problem I am trying to solve here is the Australian phone number format local numbers usually start with 04xx xxx xxx but then for international format that 0 disappear and become something like +61 4 xxxx xxxx
but now knowing it might create issues I simply added 2 additional lines in params.yaml
phone: "04"
phoneInt: "4"
countrycode: "61"
And in layouts I format those numbers like this
#local version 04xx xxx xxx for Australian users with language en Australian
<a href="tel:{{ .Site.Params.phone }}">{{ .Site.Params.phone }}</a>
# international version +61 4 xxxx xxxx with en or en-us
<a href="tel:+{{ .Site.Params.countrycode }}{{ .Site.Params.phoneInt }}">+{{ .Site.Params.countrycode }} {{ .Site.Params.phoneInt }}</a>
seems like workarounds and patches but it seems to be working. Also I started adding all numbers in “” limited to my knowledge of Hugo this is the best I comeup with
#local version 04xx xxx xxx for Australian users with language en Australian
{{ (printf `<a href="tel:0%s">0%s</a>` site.Params.phone site.Params.phone) | safeHTML }}
# international version +61 4 xxxx xxxx with en or en-us
{{ (printf `<a href="tel:+%s%s">+%s %s</a>` site.Params.countrycode Params.phone site.Params.countrycode site.Params.phone) | safeHTML }}