I use relLangURL
on render-links.html
hook. But when the links contain mailto
and ftp
, it return invalid URL. How ever it worked if contain http
or https
.
My render-links.html
:
<a href="{{ relLangURL .Destination }}">{{ .Text }}</a>
Example markdown input:
[Send me email](mailto:email@example.com)
[Download File](ftp://example.com/file.txt)
[Visit Site](https://example.com)
The result:
http://localhost:1313/en-gb/mailto:email@example.com
http://localhost:1313/en-gb/ftp:/example.com/file.txt
https://example.com
For now I tweaked render-links.html
like this:
{{ $destination := .Destination }}
{{ if not (hasPrefix $destination "mailto") }}
{{ $destination = relLangURL .Destination }}
{{ end }}
<a href="{{ $destination }}">{{ .Text }}</a>
It worked for mailto
link, but not for ftp
.
I think It would better if this handled by relLangURL
function.