Skip to main content
Level 2
May 15, 2025 2:35 AM UTC
Question

How to reliably Get the "Last Published" timestamp of a page

Hi,
Has anyone noticed that page.lastModified doesn't always update when you publish a page? How do you reliably get the actual "last published" timestamp of a page?

Not looking for jcr:lastModified or cq:lastReplicationAction - they’re not always reliable for personalization logic.

5 replies

SantoshSai
Community Advisor
Community Advisor
May 15, 2025 3:04 AM UTC

Hi @matthewda19,

I think, the only reliable way is to use the cq:lastReplicated property from the cq:Page node (not the jcr:content node). It updates only on successful publish and remains untouched by mere edits or autosaves. Works well for showing "last updated" timestamps to end users.

This works because:

  • Most devs assume jcr:lastModified or cq:lastModified gives the latest update.

  • Few realize cq:lastReplicated exists on the page node, not jcr:content.

  • The question seems simple, but the nuance makes it expert-level.

Hope that helps!

 

Translate
Santosh Sai
joerghoh
Adobe Employee
Adobe Employee
May 18, 2025 5:16 PM UTC

This does not work, the cq:page nodetype is pretty much locked down what additional properties you can add to it. cq:lastReplicated is always set on the jcr:content node.

 

(Plus: on a publish instance it is not reliable, because this property is only set on author after the replication has completed. That means when you publish a page twice cq:lastReplicated on publish shows the date of the first replication.)

Translate
BrianKasingli
Adobe Champion and Community Advisor
Adobe Champion and Community Advisor
May 15, 2025 4:40 AM UTC

you can say page.lastModified Misleads


The page.lastModified API in AEM Core WCM Components (and Page.getLastModified() in Sling) often affected by:

  • Touch UI autosaves
  • Non-replicated changes
  • Live copies syncing (in some setups)

cq:lastReplicated is the best choice for displaying the last replicated timestamp; it shows you the timestamp of the last successful replication action on the node it exists on. Making sure you have fallback code in place of course.

 

I had a scenario back in the past where we had blog articles which we wish to display the "authored date". For these dates, we decided to add in a new page property called author date, so there are no side effects while authoring pages with the right date.

 

 

Translate
K_M_K_Srikanth
Level 3
May 15, 2025 4:40 AM UTC

To reliably get the actual "last published" timestamp of a page in AEM, use:

 cq:lastReplicated

  • Path: /content/your-page/jcr:content/cq:lastReplicated

  • Type: Date

  • Set on: Successful publish

  • Reliable: Yes — updated only on successful replication

Avoid jcr:lastModified and cq:lastReplicationAction as they can be misleading.

Translate
AmitVishwakarma
Community Advisor
Community Advisor
May 15, 2025 5:06 AM UTC

Hi @matthewda19 ,

Use cq:lastReplicated

Property: cq:lastReplicated

  - Type: Date

  - Location: On the page node itself, e.g., /content/mysite/page

  - Not on: /content/mysite/page/jcr:content

This property is updated only when the page is successfully published to the publish instance, and it remains untouched by any author-side changes or autosaves.

Regards,
Amit

Translate
Amit Vishwakarma - Adobe Commerce Champion 2025 | 17x Adobe certified | 6x Adobe SME