navigation component using sightly

允我心安 提交于 2019-12-11 06:16:54

问题


I am trying to make use of Navigation api for making a global header component @http://docs.adobe.com/docs/en/cq/5-6-1/javadoc/com/day/cq/wcm/foundation/Navigation.html I have a sightly html that is able to get me the reference to the "item"

<div data-sly-unwrap data-sly-use.navitems="${'Helper'}"></div> 
<ul data-sly-list="${navitems.navigationIterator}">
    <li> ${itemList.count} ::  ${item.page.properties.jcr:primaryType} :: ${item.title} 
        ${item.navigation.element.properties.Type}
    </li>

Helper class is returning the iterator for using as a list and parsing over the itemsList. Helper class method is like this:

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

What I able to do:

I am able to access the page properties(and any custom properties). I am able to print the entire tree structure

What I can't get to:

I am unable to retrieve the Navigation.Element.Type property from the item. To make a 'UL' and 'LI' structure, I need to identify what is the Navigation.Element.Type for the item in question.

Does anyone have any pointers?


回答1:


The iterator goes through all Navigation.Element entries. Therefor you should be able to access this field by using

item.type



回答2:


Have you tried

data-sly-test=${item.listChidlren}

Or simply

<ul data-sly-list=${currentPage.listChildren}>


来源:https://stackoverflow.com/questions/29157361/navigation-component-using-sightly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!