Expand my Community achievements bar.

SOLVED

First time vs next time publish

Avatar

Level 2

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.

1 Accepted Solution

Avatar

Correct answer by
Level 4

Hi @Riyaz_Ahmed_Mohd ,

 

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

View solution in original post

1 Reply

Avatar

Correct answer by
Level 4

Hi @Riyaz_Ahmed_Mohd ,

 

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