New answers tagged


Just to provide a slight improvement to @Matanya's solution: Instead of filtering the array of Neo blocks, you can limit your query to the blocks you actually want. This way, you're not loading blocks you don't actually need. For example, to only get level one blocks: {% for module in entry.pageBuilder.level(1).all() %} See the Templating docs for Neo for ...


This is a Twig exception. When you are using an if condition on the for loop itself Twig has no way of knowing how many elements will be iterated over, or whether it is the first or last element. See: I see that support for using if on for loops was removed altogether on v3:

Top 50 recent answers are included