First time vs next time publish

Avatar

Avatar

Riyaz_Ahmed_Moh

Avatar

Riyaz_Ahmed_Moh

Riyaz_Ahmed_Moh

10-02-2021

Hi

I need to invoke functionality based on the page publish in author environment.

How AEM knows, if a page publishing is a new page or republishing an existing page? I need to check this in my code and invoke different functionalities.

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

Sanket_Kumbharkhane

Avatar

Sanket_Kumbharkhane

Sanket_Kumbharkhane

10-02-2021

Hi @Riyaz_Ahmed_Moh ,

 

you can identify this base on page replication properties like cq:lastReplicated, cq:lastReplicatedBy or cq:lastReplicatedBy.

when the page is unpublished or never published, these properties will be missing from /content/pagepath/jcr:content.

and As soon as the author publishes the page, these properties get added automatically by the system to jcr node.

 

Thus, you can write a validation code around these properties to identify the fresh pages or existing published pages.

 

you can also use  "jcr:created" property of the page to identify page age comparing to the current timestamp & filter out new or existing pages base on your requirement. cq:lastModified can use to check the last activity on the page.

 

Screenshot 2021-02-10 at 5.08.22 PM.png

Answers (0)