Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
Level 1
Level 2
Melden Sie sich an, um alle Badges zu sehen
Diese Konversation wurde aufgrund von Inaktivität geschlossen. Bitte erstellen Sie einen neuen Post.
Gelöst! Gehe zu Lösung.
Zugriffe
Antworten
Likes gesamt
Hi @karthick1356
When you say you want currentPage object in JS which is inside your clientlib, for what purpose you need it? You will not be able to get the currentPage object in JS as the context will not be avilable on clientside and it's either available on HTL or Java which is on server side.
If you can provide the use case we can come with a concrete answer.
Thanks!
Check below URL for your usecase.
Hi @karthick1356
When you say you want currentPage object in JS which is inside your clientlib, for what purpose you need it? You will not be able to get the currentPage object in JS as the context will not be avilable on clientside and it's either available on HTL or Java which is on server side.
If you can provide the use case we can come with a concrete answer.
Thanks!
Zugriffe
Antworten
Likes gesamt
@karthick1356
You can get it in Backend and put it in HTL as a hidden attribute on page:
<div id="some-id" data-page-lang="${model.lang}">
Then use the value in JS:
var lang = $("#some-id").data("page-lang");
Hope this help!
Thanks!
Zugriffe
Antworten
Likes gesamt
Zugriffe
Antworten
Likes gesamt
You can try using LanguageUtil:
Thanks!
Zugriffe
Antworten
Likes gesamt
Hi @karthick1356,
you can use Javascript USE API to get all the values you need.
Sample code:
use(function () { var Constants = { DESCRIPTION_PROP: "jcr:description", DESCRIPTION_LENGTH: 50 }; var title = currentPage.getNavigationTitle() || currentPage.getTitle() || currentPage.getName(); var description = properties.get(Constants.DESCRIPTION_PROP, "").substr(0, Constants.DESCRIPTION_LENGTH); return { title: title, description: description }; });
Reference page: https://experienceleague.adobe.com/docs/experience-manager-htl/using/htl/use-api-javascript.html?lan...
Hope this helps.
Thanks,
Kiran Vedantam
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten
Zugriffe
Likes
Antworten