You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is this Nunjucks issue or the expected behavior? Is there a way to avoid sorting by integers?
A practical workaround: Values for year have to be strings here, for example 2023- (with trailing hyphen).
{% for year, posts in posts | groupby("year") %}
<h2>{{ year | replace("-", "") }}</h2>
{% for post in posts %}
<article>{{ post.title }}</article>
{% endfor %}
{% endfor %}
Thank you.
The text was updated successfully, but these errors were encountered:
Hi all,
if you take this example from the Nunjucks website …
… the order of the array is respected:
green
comesbefore
blue
:Output
But if you use integers (or even quoted integers) …
… the output is sorted numerically:
Output
Expected output
Is this Nunjucks issue or the expected behavior? Is there a way to avoid sorting by integers?
A practical workaround: Values for
year
have to be strings here, for example2023-
(with trailing hyphen).Thank you.
The text was updated successfully, but these errors were encountered: