Hi All,
I want to output template name as a css class on body tag of my page. In body.jsp we have done this, which works on author env but does not work on publish env? Is it because template resource is not available in publish env. Is there a simple way to fix it?
<c:set var="pageCssClass" value="${currentPage.name}-page" /> <c:set var="templateCssClass" value="${currentPage.template.name}-template" /> <body class="<c:out value="${pageCssClass} "/><c:out value="${templateCssClass} "/><wcmmode:edit>edit</wcmmode:edit>"
Solved! Go to Solution.
Views
Replies
Total Likes
Oh. Hmm, I honestly don't know how you'd do that other than splitting the string.
Views
Replies
Total Likes
The template itself cannot be read on Publish because of read permissions under the /apps folder.
You can switch your code to use ${currentPage.properties['cq:template']}
Views
Replies
Total Likes
Yes that give me long path like
cq:template | String | /apps/mysite/templates/default-page |
Even though I can get the last element after last "/". But wanted to know if there is better way.
Views
Replies
Total Likes
Oh. Hmm, I honestly don't know how you'd do that other than splitting the string.
Views
Replies
Total Likes
Thanks for your reply, I can't thinking anything else will go with the string split option
Views
Replies
Total Likes