Expand my Community achievements bar.

SOLVED

Accessing properties from Sub objects in page properties from HTL or Use classes

Avatar

Level 3

Hi,

I have the following structure within a page where we store details of a person.  There will be one person per page and we have tried to give the person data some sort of structure to break things up (eg jcr:content\person and jcr:content\person\social)

It might be late in the day but I am blank as to how to access these properties and objects from within either HTL or a supporting use class.

Could anyone shed any light on this?

Thanks

Screen shot of structure included.

personXML.PNG

1 Accepted Solution

Avatar

Correct answer by
Level 3

Hi,

I think we will likely use that approach going forward.  However we noticed that we can use the pageProperties from within the HTL. Seems to work as we expect. So we will go with this in the meantime. 

Thanks

<a href="${pageProperties['person/social/linkedin']}" title="Connect to ${pageProperties['person/name']} on LinkedIn" target="_blank">Connect</a>

View solution in original post

3 Replies

Avatar

Level 10

Component way...

1. Create a component which render person node.

2. Write up a sling model which can read properties ( technically it will adapt to resource)

3. Use the values returned by sling model in HTL

AEM Developer Learning : Sling Model Exporter in AEM 6.3

Thanks

Avatar

Correct answer by
Level 3

Hi,

I think we will likely use that approach going forward.  However we noticed that we can use the pageProperties from within the HTL. Seems to work as we expect. So we will go with this in the meantime. 

Thanks

<a href="${pageProperties['person/social/linkedin']}" title="Connect to ${pageProperties['person/name']} on LinkedIn" target="_blank">Connect</a>