Highlighted

Sightly convert string to node

Avatar

Avatar

sr508

Avatar

sr508

sr508

30-09-2019

Hi,

is there a possiblitiy to convert the string to node in sightly.

if i have ${item.name} which is the name of the node . But ${item.name} is retiring as string. i need to access the properties of the node.

Any suggestions will be helffull

Replies

Highlighted

Avatar

Avatar

ArpitVarshney

MVP

Avatar

ArpitVarshney

MVP

ArpitVarshney
MVP

30-09-2019

Hi,

You can get the property of the node in HTL using their path as shown below:

<sly data-sly-use.page="/content/dev-aem/en/jcr:content">${page.jcr:title}</sly>

Also, I would recommend writing these logics in JS use API or Java classes.

Highlighted

Avatar

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831

Avatar

Arun_Patidar

MVP

Total Posts

2.9K

Likes

1.0K

Correct Answer

831
Arun_Patidar
MVP

30-09-2019

try ${item.propertyName}

If you want to get child node from the item node based on the name of the node, then you need to write JS use API or Java Model.