ListChildren recursively in sightly

2.4k Views Asked by At

There is one method of Page interface which can be used in sightly to iterate through children.

I want to iterate all the subsequent children reccursively.

there is an overloaded method listChildren(Filter ,Boolean) which can do that ......how to call this method from sightly?? I mean how Should onemodify the tag mentioned above to do it recursively.

1

There are 1 best solutions below

0
On

You may define a data-sly-template, which is some kind of macro, and then call it recursively with data-sly-call:

<template data-sly-template.descendants="${@ page}">
    ${page.title}
    <ul data-sly-list.child="${page.listChildren}">
      <li data-sly-call="${descendants @ page=child}"></li>
    </ul>
</template>

<div data-sly-call="${descendants @ page=currentPage}" data-sly-unwrap></div>