creative designer

The fun thing about the undocumented sort_by property on collections is that you can pass whatever string to it that you like, and then be able to use it in Liquid. It's a pretty gross hack, but it might come in handy one day.

I can see a bunch of interesting uses. One could be passing a promo image in the url. A different sort by value would load a different image. For example:

The Liquid code in the collection template just pulls the collection.sort_by value and splits at the colon. Whatever is left is assumed to be an asset, so we show it.

Now the example here could be easily, and better handled with JavaScript but it's more to prove the point that we're using Liquid to drive this. Disable JS in your browser if you want to test it.

The usual warning

Doing this might break your actual collection sorting dropdown menus. You'd need to adapt the code so it can handle the fact that you've done something weird.

The fact that collection.sort_by is not documented means it could be removed without warning. Make sure your code is ready for it.

I don't see huge value in doing this on the direct customer facing templates but I feel something awesome could take advantage of this with alternate templates, and JS.

Like to work with me?

Let's talk