ref: 0ba9fb9631f6f97ae50929006937b540b1ff8a37
parent: ba8a00a6f98650340457d79927352dc542001bba
author: digitalcraftsman <[email protected]>
date: Sat Dec 3 15:12:12 EST 2016
docs: Document querify template func Closes #2733
--- a/docs/content/templates/functions.md
+++ b/docs/content/templates/functions.md
@@ -880,6 +880,16 @@
e.g. `<a href="/tags/{{ . | urlize }}">{{ . }}</a>`
+### querify
+
+Takes a set of key-value pairs and returns a [`url.Values`](https://godoc.org/net/url#Values) object. The [`Encode`](https://godoc.org/net/url#Values.Encode) method turns the pairs into a [query string](https://en.wikipedia.org/wiki/Query_string) that cen be postpended to a url. E.g.
+
+ <a href="https://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a>
+
+will be rendered as
+
+ <a href="https://www.google.com?page=3&q=test">Search</a>
+
## Content Views