Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Page properties image path from listChildren loop

Avatar

Level 2

How can I get the url of a page image when looping through the children using sightly?

Here is what I have been trying with no success:

<div data-sly-list.subChild="${child.listChildren}">

     <img src="${subChild.image.properties.fileReference}">

</div>

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 10

You would need to get at the correct node under a page that has this property:

FF1.png

Personally - if I had that requirement, I would do that in the Java part of an HTL component and populate a collection and then simply write out the collection in the HTL component.

View solution in original post

5 Replies

Avatar

Employee

What do you mean with "page image"?

Avatar

Level 10

You want to locate an image in a page and try and get the URL that resolves the image?

Avatar

Level 2

It's an image set in a page property, yes.

Avatar

Correct answer by
Level 10

You would need to get at the correct node under a page that has this property:

FF1.png

Personally - if I had that requirement, I would do that in the Java part of an HTL component and populate a collection and then simply write out the collection in the HTL component.