Expand my Community achievements bar.

SOLVED

Remove versionnode path pages from aem page reference

Avatar

Level 2

Hi All,

 

We are having a scenario where /content/versionhistory... path are also coming in  references for pages. We tried to limit it by adding exclude path property in cq:lucene but no luck. Can someone please help in this ?

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @yashaswidotiya 

 

You can handle by Simply creating an JCR Event Listner for versionhsitory node created and delete version history node as soon as node created.

 

observationManager.addEventListener(this, Event.NODE_ADDED "/content/versionhistory"truenull,

  new String[]{"cq:Page"} , true);

 

You can find more detail about above method at ObservationManager (Content Repository for Java Technology API 1.0)

 

 

View solution in original post

4 Replies

Avatar

Community Advisor

@yashaswidotiya 

 

Whenever author do page compare with any older version, that older version is created as page inside versionhistory node and shows as a page. Please check the below post and it will give you an answer.

 

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-verionhistory-node-und... 

Avatar

Level 2

I am aware that version gets created but we are trying to remove those entries from the references which should not be there. When we check for references from the miscadmin, we should not be seeing versionhistory nodes.

Avatar

Correct answer by
Community Advisor

Hi @yashaswidotiya 

 

You can handle by Simply creating an JCR Event Listner for versionhsitory node created and delete version history node as soon as node created.

 

observationManager.addEventListener(this, Event.NODE_ADDED "/content/versionhistory"truenull,

  new String[]{"cq:Page"} , true);

 

You can find more detail about above method at ObservationManager (Content Repository for Java Technology API 1.0)

 

 

Avatar

Level 2

We don't require a version history node deletion but only remove them from page reference.