Today I got frustrating errors related to finding how many elements exists in a Freemarker collection. And of course seeing if the collection is empty or not. The solution is simple:

<#if (project.tasks?size > 0) >
</#if>

So you have to use parenthesis and the “>” will be escaped!