The function isSafeURL
in https://golang.org/src/html/template/url.go looks at the URI scheme. The scheme is everyting that comes before the colon “:” rune. If the scheme isn’t one of { http, https, mailto }
then the URL is not considered safe and ZgotmplZ
is printed.
I was trying to render some file:///filename.html
links and they were not rendering when using hugo. You can fix this by using the safeURL
filter:
<link rel="stylesheet" href="{{"css/my.css" | absURL | safeURL}}" type="text/css">