My understanding is that Liquid converts Ruby Hashes to arrays for use in tags. For example, when using Jekyll:
{% for category in site.categories %}
<li>{{ category[0] }}</li>
{% endfor %}
… converts site.categories to an array of tuples in which [0] refers to the key, [1] the list of values.
If I wanted the above category map to be sorted alphabetically by the key ([0] of each tuple) how can I do this?
Neither the default Liquid implementation nor the additions made by Jekyll allow for what you want.
I’m afraid what you want is simply not possible with the current setup. You would have to monkeypatch Jekyll or Liquid in order to make the hashes return their keys in a sorted order.