Add items to an array in Nunjucks
To add items in Nunjucks, use the .push() function.
{% set arr = [1,2] %}
{% set arr = (arr.push(3), arr) %}
Final array:
arr = [1,2,3]
Unfortunately, I did not found any references in the official Nunjucks documentation for this useful functio...
giuliachiola.hashnode.dev1 min read
Manjunatha Kaliyur
TY. Found this after trying to accomplish this exact same feature. This is really useful.