passing query parameters

Highlighted
Tourist
19 0 1
Is there a way to pass a query parameter in an URL to liquid? Example: http://www.shop.com/pages/about-us?q=bla I would like to get to use q=bla in liquid. Depending on the value of q I would like to show different text. is this possible ? thanks
0 Likes
New Member
1 0 0

+1 for getting this answered

0 Likes
Excursionist
699 0 8

type “query” into the little box top right.

operation absurdist feature requests: terminated (http://en.wikipedia.org/wiki/Absurdism)
0 Likes
Shopify Staff
Shopify Staff
2002 0 41

you have to use javascript for any kind of dynamic response to query parameters.

Tobias Lütke - Shopify CEO // http://twitter.com/tobi
0 Likes
Shopify Expert
3937 16 325

Hi,

Your example implies you would like to have links pointing to the same page, but showing different text?

eg:

/pages/about-us?q=foo /pages/about-us?q=bar

You can simply code up the about-us page to have foo and bar text on the same page, but contained in named anchors. Point your link to the page and include a reference to the named anchor, and voila, you have sent the person to the text you want.

If you truly want to keep the text specific and separate, just make different pages and make links for them.

If you must be fancy pants and you follow Tobi’s advice to use Javascript to achieve the effect of one page having all the text, but only showing certain parts based on a criteria, you’ll find the use of cookies much more satisfying than playing games with URL parameters. Especially since URL parameters meant to inform the server of what content to provide are useless with the Shopify Rails application that ignores them.

Make sense?

Custom Shopify Apps built just for you! hunkybill@gmail.com http://www.resistorsoftware.com
0 Likes