Hi Team,
I need to print the link of references in page wherever the current page is being referenced. How should I approach this in optimized way.
@arunpatidar @lukasz-m @kautuk_sahni
@SivakumarKanoori @Fanindra_Surat @Jagadeesh_Prakash @krati_garg @iamnjain @somen-sarkar @bajancherry @sunil_kumar_ @shelly-goel @Ganthimathi_R @davidjgonzalezzzz @krishna_garikapati @Shubham_borole @milind_bachani @krishna_sai @manjunathdj
Solved! Go to Solution.
Hi @AditiSi,
AEM have internal service (ReferenceSearch) to get reference pages.
ReferenceSearch referenceSearch = new ReferenceSearch();
referenceSearch.setSearchRoot("/content/wrapper");
List<Page> resultSet = referenceSearch.findPageReferencesForResource(
resolver, CURRENT_PAGE_PATH, -1, -1);
Views
Replies
Total Likes
Your question is not clear to me, but I guess what you are trying to ask is how to share properties between components, if so, there are several approaches you could use, let me detail a couple of them:
1. You could use the Shared Component Properties from ACS Commons, you can learn more here: https://adobe-consulting-services.github.io/acs-aem-commons/features/shared-component-properties/ind... https://www.bounteous.com/insights/2016/12/03/shared-component-properties
2. You could add the shared properties at the page level, that way the properties would be available for every component living on the page
3. You could add a separate and dedicated location to store this shared information, it could be ACS common list, a content fragment, etc
4. You could even embed the image component in the wrap component so you can infer the shared properties in the backend (slind model).
Here are more options:
https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/finest-way-to-exchange-dat...
https://www.alexlockhart.me/2021/01/aem-sharing-data-between-components.html
Hope this helps.
Views
Replies
Total Likes
Views
Replies
Total Likes
Hi @AditiSi,
AEM have internal service (ReferenceSearch) to get reference pages.
ReferenceSearch referenceSearch = new ReferenceSearch();
referenceSearch.setSearchRoot("/content/wrapper");
List<Page> resultSet = referenceSearch.findPageReferencesForResource(
resolver, CURRENT_PAGE_PATH, -1, -1);
Views
Replies
Total Likes
it's giving error for findPageReferencesForResource method , I'm using aem 6.5 .
Views
Replies
Total Likes
In AEM v6.5.0, you can use referenceSearch.search(resolver, CURRENT_PAGE_PATH). However, I checked on AEM v6.5.13 and findPageReferencesForResource is available there.
Views
Replies
Total Likes
Hi ,I'm using below code to set the rootpath for reference search but it's not working:
ReferenceSearch referenceSearch = new ReferenceSearch();
referenceSearch.setSearchRoot("/content/test");
Collection<ReferenceSearch.Info> refs = referenceSearch.search(resourceResolver,currentPage.getPath()).values();
my currentpage path is something like this -- "/content/test/propertyimages/xyz-bar"
Am I doing something wrong?
Views
Replies
Total Likes
Could you please try without specifying the search root path?
Views
Replies
Total Likes
without search root path, it's working but the I want to limit the search path so that it can be efficient and doesn't go through each and every folder. Is there a way to achieve this?
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies
Views
Likes
Replies