Hi Guys,
I have an HTL component that displays the title and description of the children of the current page, it works well but there is one thing that is bugging me.
Here's the basic code of my component. I can't get ${cover.link} or ${cover.url} to work for the href to each child page as per the instructions here. As you can see ${cover.path}.html works but it's not ideal.
<div data-sly-repeat.cover="${currentPage.listChildren}" data-sly-attribute.class="${cover.name} industry">
<h4><a href="${cover.path}.html">${cover.title}</a></h4>
<p>${cover.description}</p>
</div>
Any suggestions would be appreciated.
Cheers Jeff
Solved! Go to Solution.
Hi MavicNz
Url and link are not the implicit keyword to fetch the path of your Page So when your are trying to access with the object it will not return any thing.
Check All implicit object
Currentpage is implicit object you can fetch the methods of this api com.day.cq.wcm.api.Page
Page (Adobe AEM 6.0.0 API 6.0.0 API)
getDescription ---> description |
Name, tilte and Path are the implicit properties in the jcr of page so it is giving you the value.
their is no such method like getLink or getUrl for this if you have these properties in your page jcr then you can fetch these properties by simply
${listChildObject.PropertyName} it will return the property if it is in jcr of page otherwise nothing will come.
Hope this will Helpful !
Hi MavicNz
Url and link are not the implicit keyword to fetch the path of your Page So when your are trying to access with the object it will not return any thing.
Check All implicit object
Currentpage is implicit object you can fetch the methods of this api com.day.cq.wcm.api.Page
Page (Adobe AEM 6.0.0 API 6.0.0 API)
getDescription ---> description |
Name, tilte and Path are the implicit properties in the jcr of page so it is giving you the value.
their is no such method like getLink or getUrl for this if you have these properties in your page jcr then you can fetch these properties by simply
${listChildObject.PropertyName} it will return the property if it is in jcr of page otherwise nothing will come.
Hope this will Helpful !
Hi,
Thanks for the reply, I understand that it doesn't return anything as I have tested both options.
I was probably meaning why is it detailed like that in the documentation if it's not a property you have access to?
<!--/* Good */-->
I was hoping that HTL might have advanced somewhat compared to the JSTL hoops you have to jump through to get a page link but it appears not.
You would think a page URL would be something fairly basic for a website CMS to make available without too much work.
Cheers Jeff
Views
Replies
Total Likes
Hi Mavic,
Yes they took those example as a reference but they didn't mention the object is implicit or not.You should prefer adobe documentation in that case you find any conflict.
Thanks
Views
Replies
Total Likes
Thanks again,
Shows you can't always trust what you read on the internet I found what I needed on this Adobe docs page HTL Block Statements
Cheers Jeff
Views
Replies
Total Likes
Views
Likes
Replies