Hi Folks,
I have a page (pagea), this page exist in en, fr, and de
Now this page has 3 language copies
I need to fetch all the existing language copies of page, how would I fetch it using some API.
Please do not suggest below
http://localhost:4502/libs/wcm/core/content/pageinfo.json?path=/content/test/en/pagea
Any pointers is highly appreciated.
Thanks,
Pradeep
Solved! Go to Solution.
Views
Replies
Total Likes
Hello @pradeepdubey82
Please try following API:
for (final Page page : languagemanager.getLanguageRoots(res,
currentPagePath)) {
languagePages.put(page.getLanguage(false), page);
}
Here getLanguageRoots() should return all Language copies of current page. The relevant language details can then be retreived via page.getLanguage()
Hello @pradeepdubey82
You might want to explore LanguageManager API
It is used extensively in https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/w...
So, some good examples would be available in the java file.
I could not see any method in https://github.com/adobe/aem-core-wcm-components/blob/main/bundles/core/src/main/java/com/adobe/cq/w...
Which is giving list of language copies of current page.
My requirement is, let's say I am on pagea of en, then it should return list of language copies
/content/test/fr/pagea
/content/test/de/pagea
Please check this java doc for LiveRelationshipManager interface which provides methods to get live copies of the given resource (in your case page resource).
Hello @pradeepdubey82
Please try following API:
for (final Page page : languagemanager.getLanguageRoots(res,
currentPagePath)) {
languagePages.put(page.getLanguage(false), page);
}
Here getLanguageRoots() should return all Language copies of current page. The relevant language details can then be retreived via page.getLanguage()