I've manually ordered a dictionary called lang_selection_list
. I would like to loop over that list and use the key, val
to set a select/options tag
Problem: My output created by loop seems to be in a random order and I dunno why?
Question: How do I loop over lang_selection_list
so that the order of my options are in the same key value order i've written them in?
{% var as lang_selection_list %}
{
"af_ALL": "Afrikaans",
"az_ALL": "Azərbaycanca",
"id_ALL": "Bahasa Indonesia",
"ca_ALL": "Català",
"si_ALL": "සිංහල",
}
{% endvar %}
<select>
{% for key,val in lang_selection_list.items %}
<option value="/{{key}}/index.html">{{val}}</option>
{% endfor %}
</select>