Shivani Garg
Shivani Garg

Reputation: 735

Using Navigation API In Sightly AEM

I am trying to use navigation api in sightly.

Following the link : navigation component using sightly

I am getting the list of pages,but ${item.type} is not working for me,thats why i am not able to apply proper DOM structure(html of the component). Can anyone please help me?

Upvotes: 1

Views: 990

Answers (1)

Ameesh Trikha
Ameesh Trikha

Reputation: 1712

If you look at javadocs, navigation.getIterator() returns Navigation.Element, so the method returns iterator of Navigation.Element-

    public Iterator getNavigationIterator() {
     Navigation nav = new Navigation(getCurrentPage() , absParent , new PageFilter(getRequest()), 3);
     return nav.iterator();
}

The sightly expression will look something like -

<ul data-sly-list.navElement="${navitems.navigationIterator}">
    <li>
        ${navElement.type}
    </li>
</ul>

Upvotes: 1

Related Questions