How to use tel: ftp: and file: protocols in a Url variable

Hi,

I am trying to use a tel: link

When I display the data e.g.

{{ .LINK }}   it is fine  i.e.  tel:1111

But insite an a tag e.g.

<a href="{{ .LINK }}"></a>

it becomes

If I create

 {{ .LINK }} <a {{.LINK}} ref="{{ .LINK }}">

I get

 tel:1111<a <a  ZgotmplZ href="#ZgotmplZ">

So it looks like within an <a> there is some special processing that does’nt like tel:

Tried this with mailto: http: and https: and it works normally

tel: ftp: file: protocols don’t

Please advise

p.s. hard coding <a href="tel:1111"> into nav partial is fine it is the variable substitution

OK

found it

{{ .URL | safeURL }}

The docs are here https://github.com/spf13/hugo/blob/master/docs/content/templates/functions.md

1 Like