How and from where can we get the last modification date of the whole site ? | Community
Skip to main content
Level 3
February 28, 2024
Solved

How and from where can we get the last modification date of the whole site ?

  • February 28, 2024
  • 3 replies
  • 1993 views

Hi Team,

 

I want to get the last modification date of my site in one of the component. But the thing is let suppose there are 50 pages in my site and if I am making any kind of change in any of the pages. I want to get that modification date. Like I want to get the modification date for whole site. So where is this date is getting maitanined in aem ? Kindly help on this.

 

Thanks

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 joerghoh

AEM does not have an implicit concept of a site (as in a specific Site class/object). "Sites" are normally represented by pages into a project-specific hierarchy structure. Also, AEM does not manage sites as an entity, but only knows of pages, which can be updated individually or in bulk.

 

That means, that you need to come up with your own definition of a site, and what "last modification" date of a site means. Is the latest change published on any page below a certain tree? What about updates on assets which are referenced from these pages?

 

As soon as you have a clear definition of it, you can think about implementing it. I can think of many ways to implement, with different tradeoffs regarding performance impact and accuracy.

3 replies

Level 7
February 28, 2024

Hi @monish_gavali 

 

I do not think, you can get such type of modification date in AEM site. Since, in AEM each page is independent of each other. Suppose, in case of Drupal or any other CMS, they have the database. So, in those applications, they can(might??) get the recent modification date. But, in AEM, I do not think so.  

Will wait, for others reply 🙂

kautuk_sahni
Community Manager
Community Manager
February 28, 2024

@monish_gavali 

  • There is no central location in AEM that stores the last modification date for the entire site.
  • Each page and component maintains its  jcr:lastModified property with the individual modification timestamp.

Recommended Approaches:

  1. Using jcr:lastModified in HTL:

      • Every page and component in AEM possesses a property called jcr:lastModified. This property reflects the last modification date and time of that specific element.
      • You can access this property within your component and display the desired information using HTL expressions. Here's an example:
      <sly data-sly-use="${'com.yourcompany.MyComponent'}"></sly>
      
      public String getLastModifiedDate() {
        return properties.get("jcr:lastModified").getString();
      }
  2. Custom Workflow:

    • The concept of developing a workflow to iterate through pages and gather the latest modification date is still valid. However, specific implementation details might vary depending on your AEM version and requirements. Consult the Adobe Experience Manager documentation for the latest best practices on building workflows.
Kautuk Sahni
Level 3
February 28, 2024

Yes I am aware of the last modification date of the individual resources. Thanks for this information, but is there any log file where all the activities are getting captured and from that file we may able to get the date of last activity ? is it possbile ?

joerghoh
Adobe Employee
joerghohAdobe EmployeeAccepted solution
Adobe Employee
February 28, 2024

AEM does not have an implicit concept of a site (as in a specific Site class/object). "Sites" are normally represented by pages into a project-specific hierarchy structure. Also, AEM does not manage sites as an entity, but only knows of pages, which can be updated individually or in bulk.

 

That means, that you need to come up with your own definition of a site, and what "last modification" date of a site means. Is the latest change published on any page below a certain tree? What about updates on assets which are referenced from these pages?

 

As soon as you have a clear definition of it, you can think about implementing it. I can think of many ways to implement, with different tradeoffs regarding performance impact and accuracy.

Level 3
March 15, 2024

Yes, the "last modification" date of a site means the latest change published on any page below a certain tree. I have implemented this by using Event Listeners in AEM.