AEM Sightly to get properties of child nodes.

一笑奈何 提交于 2019-12-06 14:59:44

Why don't you use a WCMUse Java class or a JS use?

What you are looking for is custom for what you are trying to achieve so you should have your own controller and access the properties of child nodes, Sightly is a templating language, it's made simple on purpose, if you need specific stuff create a Use Java or JavaScript object and access it with Sightly.

METHOD 1: HTL/Sightly

with the data structure in your question:

<sly data-sly-list.device="${resource.listChildren}">
  ${device.name} // this should output 'mobile' or 'desktop', etc.
  ${device.path} // this should output the paths
</sly>

METHOD 2: Javascript USE API

This is the node (navbarnavitem) from which i want to access item0 and item1:

This is the getLinks method that helps me do that (each item has two properties - href and linkText:

Good Luck...

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