collections.Querify
通過單獨的參數或作為切片來指定鍵值對。以下兩種寫法是等效的:
{{ collections.Querify "a" 1 "b" 2 }}
{{ collections.Querify (slice "a" 1 "b" 2) }}
將查詢字符串附加到 URL:
{{ $qs := collections.Querify "a" 1 "b" 2 }}
{{ $href := printf "https://example.org?%s" $qs }}
<a href="{{ $href }}">Link</a>
Hugo 渲染後如下:
<a href="https://example.org?a=1&b=2">Link</a>