27 August 2026 • 51 words
sort() in Nunjucks is a version of jinja's sort, it takes three parameters:
sort(reverse, case_sensitive, attribute)reverse(boolean) sorts descending instead of ascendingcase_sensitive(boolean) will sort upper and lower case strings separatelyattribute(string) the attribute to sort the object by
In my index.njk layout I am sorting collections like so:
collections.post | sort(true, true, 'date')