First time vs next time publish | Community
Skip to main content
Level 2
February 10, 2021
Solved

First time vs next time publish

  • February 10, 2021
  • 1 reply
  • 1046 views

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sanket_Kumbharkhane

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.

 

1 reply

Sanket_Kumbharkhane
Sanket_KumbharkhaneAccepted solution
Level 4
February 10, 2021

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.