Page properties image path from listChildren loop | Community
Skip to main content
adamm42245876
Level 2
Dec 20, 2017 4:50 PM UTC
Solved

Page properties image path from listChildren loop

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Dec 21, 2017 3:37 PM UTC

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

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.

5 replies

smacdonald2008
smacdonald2008Accepted solution
Level 10
Dec 21, 2017 3:37 PM UTC

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

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.

Translate
adamm42245876
Level 2
Dec 21, 2017 3:32 PM UTC

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

Translate
smacdonald2008
Level 10
Dec 21, 2017 3:30 PM UTC

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

Translate
adamm42245876
Level 2
Dec 21, 2017 3:24 PM UTC

It's a page property

Translate
Feike_Visser1
Employee
Dec 21, 2017 9:53 AM UTC

What do you mean with "page image"?

Translate