Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

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

Avatar

Level 4

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

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.

View solution in original post

5 Replies

Avatar

Level 8

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

Avatar

Administrator

@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

Avatar

Level 4

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 ?

Avatar

Correct answer by
Employee Advisor

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.

Avatar

Level 4

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.