This question relates to an earlier post I made here:
I’m trying to extend the Navigation Core Component and add the subtitle and description page properties at the group level. This is my test code so far in the group.html of the component:
<template data-sly-template.group="${@ items='The navigation items for the current level'}" data-sly-use.itemTemplate="item.html">
<ul class="cmp-navigation__group" data-sly-list="${items}">
${item.properties.subtitle} ${item.description}<sly data-sly-call="${itemTemplate.item @ item=item}"></sly>
</ul>
</template>
While the solution in my previous post worked in my local HTL REPL page, and I can currently get the description property in the Navigation Core Component, I once again cannot get the subtitle property. Subtitle is not a custom property and is part of the OOTB page properties, so I assume I’m just missing the required syntax?
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @JonMaguire,
In your previous question the answer was to use ${item.properties.subtitle} because in that case, the item in question was a Page object.
In the case of the Navigation component, the item is not a Page object but a NavigationItem object (you can see this by checking out the getItems() method of the Navigation interface) which does not have a getProperties() method, so ${item.properties.subtitle} will not work
Instead, I recommend you make your own class that extends the NavigationItem interface and provides a getSubtitle() method.
Hi @JonMaguire,
In your previous question the answer was to use ${item.properties.subtitle} because in that case, the item in question was a Page object.
In the case of the Navigation component, the item is not a Page object but a NavigationItem object (you can see this by checking out the getItems() method of the Navigation interface) which does not have a getProperties() method, so ${item.properties.subtitle} will not work
Instead, I recommend you make your own class that extends the NavigationItem interface and provides a getSubtitle() method.
Views
Replies
Total Likes
Views
Like
Replies