How to get query or param from URL and then use in Links? I'm trying to grab the query or param from an URL and then add it to an URL.

like products?price=15

How can I add the ?price=15 to a URL?

Like products/category?price=15?
Use craft.request.getQueryStringWithoutPath() like so:

products/category?{{craft.request.getQueryStringWithoutPath()}}



  Returns the query string, except for the p= param (which was probably added by your .htaccess redirect).


More complicated logic to avoid the ? when the query string is empty (one of several ways to do this):

{# queryString will include '?' if we have one, otherwise '' #}
{% set queryString = (craft.request.getQueryStringWithoutPath() ? '?'~craft.request.getQueryStringWithoutPath()) %}
products/category{{queryString}}