absolute Developer Jahia 7.3 Jahia 8 Legacy

How to get the content of an absolute area

Question

The customer would like to get the content of an absolute area in order to display this content in another place on the site.
For that, the customer has defined a template with one absolute area with a Rich Text content and a bound component (metadata display) to bind this Rich text content. This works for the Home page but this does not work for the other pages of the site.

Cause

The bound component can only retrieve the metadatas of the Rich text content created in the absolute area because this is precisely an absolute area.
The reason is detailed in our documentation from: https://academy.jahia.com/documentation/techwiki/content/templates-and-layout#Areas_and_absolute_areas

Solution

One solution is to retrieve the content in a non-absolute area.

Another solution, less elegant and whether the absolute area is mandatory, is to get the absolute area ID as a child node of the Home page and to use the jcr:node tag as below:
 

- JCR: /sites/bindedComponent/home/absolute-area992886
- ID: 0a7995cf-51ef-4995-9e0b-1dadba39892c


Bound Component code:

<jcr:node var="boundComponent" uuid="0a7995cf-51ef-4995-9e0b-1dadba39892c"/>

<c:forEach var="item" items="${jcr:getChildrenOfType(boundComponent,'jnt:bigText&')}">
<c:if test="${jcr:isNodeType(item,'jnt:bigText')}">
    ${item.properties.text.string}
</c:if>
</c:forEach>