-1

I am trying to create a conditional if function that displays a result if the length of the list is greater than 5:

{% if length(photos) > 5 %}
...
{% endif %}

However, I get Could not parse the remainder: '(photos)' from 'length(photos)', where am I going wrong?

Thanks

davidism
  • 121,510
  • 29
  • 395
  • 339
alias51
  • 8,178
  • 22
  • 94
  • 166

1 Answers1

12

Correct syntax is:

{% if photos|length > 5 %}
...
{% endif %}
Ashwini Chaudhary
  • 244,495
  • 58
  • 464
  • 504