Hey everyone,
I need to arrange my taxonomylist alphabetically. I found older forumposts mentioning the ksort function, but it seems not to work anymore. Also found something about the sort_by_key function and tried that, but I think I’m not doing it correctly. Could you help out? Here is my code:
{% set taxlist = taxonomylist.get() %}
{% if taxlist %}
{% set category = grav.uri.params("category", true) %}
{# for tax,value in taxlist['category']|sort_by_key('tax') #}
{% for tax,value in taxlist['category']|ksort %}
{% set current_page = (tax == category) ? 'active' : '' %}
<li class="">
<a href="{{ page.url }}/category{{ config.system.param_sep }},{{ tax|e('url') }}">{{ tax|capitalize }}</a>
</li>
{% endfor %}
{% endif %}
Thanks in advance!