Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tpl: Add a querify function to generate query strings inside templates #2257

Closed
wants to merge 1 commit into from
Closed

tpl: Add a querify function to generate query strings inside templates #2257

wants to merge 1 commit into from

Conversation

jimmysawczuk
Copy link
Contributor

@jimmysawczuk jimmysawczuk commented Jul 5, 2016

The querify function will take a set of parameters specified like a dict and return a url.Values object which can be .Encode'd into a query string.

Example:

<a href="http://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a>

Returns:

<a href="http://www.google.com?page=3&q=test">Search</a>

@bep
Copy link
Member

bep commented Jul 5, 2016

Looks good. Could you "correct" your commit messages (I know, pedantic, but we like the imperative mood and titles without period at the end).

The query function will take a set of parameters specified like a dict and return a url.Values object which can be .Encode'd into a query string.

Example:

<a href="http://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a>

Returns:

<a href="http://www.google.com?page=3&q=test">Search</a>
@jimmysawczuk jimmysawczuk changed the title tpl: Adds a querify function to generate query strings inside templates. tpl: Add a querify function to generate query strings inside templates Jul 5, 2016
@jimmysawczuk
Copy link
Contributor Author

@bep no problem, fixed (I think) (and squashed into one commit).

@bep bep closed this in fbf4882 Jul 5, 2016
tychoish pushed a commit to tychoish/hugo that referenced this pull request Aug 13, 2017
The query function will take a set of parameters specified like a dict and return a url.Values object which can be .Encode'd into a query string.

Example:

<a href="http://www.google.com?{{ (querify "q" "test" "page" 3).Encode | safeHTML }}">Search</a>

Returns:

<a href="http://www.google.com?page=3&q=test">Search</a>

Closes gohugoio#2257
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants