urlquery
返回其参数文本表示的转义结果,适合嵌入 URL 查询串。
用法
这段模板代码:
{{ $u := urlquery "https://" "example.com" | safeURL }}
<a href="https://example.org?url={{ $u }}">Link</a>渲染结果为:
<a href="https://example.org?url=https%3A%2F%2Fexample.com">Link</a>更多信息参见 Go 的 text/template 文档。