Inside a rendering variant I added a template. Inside that I want a for each loop. Can anyone please suggest if it's feasible. Sitecore 9.2

  • if you mean for each inside a nvelocity template you can use: #foreach($child in $item.Children) $child.Name #end Sep 14, 2020 at 19:38

1 Answer 1


As you mention 9.2 we can assume this is a NVelocity template. As Vlad mentioned, you can use a foreach loop there as shown here: http://people.apache.org/~henning/velocity/html/ch05s04.html

  #foreach( $product in $allProducts )

Note however that 9.2 is the last version that support NVelocity - and it usually is not such a good idea to put too much logic inside a NVelocity template.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.