How to display the links of the references where particular page is being referenced. | Adobe Higher Education
Skip to main content
Level 2
September 26, 2023
Risolto

How to display the links of the references where particular page is being referenced.

  • September 26, 2023
  • 3 risposte
  • 3029 visualizzazioni

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  

Questo argomento è stato chiuso alle risposte.
Migliore risposta di Mahedi_Sabuj

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);

https://developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/wcm/commons/ReferenceSearch.html#findPageReferencesForResource(org.apache.sling.api.resource.ResourceResolver,java.lang.String,int,int) 

 

 

3 risposte

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
September 26, 2023

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/index.html 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-data-between-aem-components/m-p/215859 
https://www.alexlockhart.me/2021/01/aem-sharing-data-between-components.html 

 

Hope this helps.

Esteban Bustamante
iamnjain
Community Advisor
Community Advisor
September 26, 2023

Hi @aditisi 

 

Can you please explain your requirement one more time in comments?

Mahedi_Sabuj
Community Advisor
Mahedi_SabujCommunity AdvisorRisposta
Community Advisor
September 26, 2023

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);

https://developer.adobe.com/experience-manager/reference-materials/cloud-service/javadoc/com/day/cq/wcm/commons/ReferenceSearch.html#findPageReferencesForResource(org.apache.sling.api.resource.ResourceResolver,java.lang.String,int,int) 

 

 

Mahedi Sabuj
AditiSiAutore
Level 2
September 27, 2023

it's giving error for findPageReferencesForResource method , I'm using aem 6.5 .

 

Mahedi_Sabuj
Community Advisor
Community Advisor
September 27, 2023

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.

Mahedi Sabuj