Sitemap update without iterating through JCR | Community
Skip to main content
Level 2
January 18, 2018
Solved

Sitemap update without iterating through JCR

  • January 18, 2018
  • 2 replies
  • 1385 views

I am creating a sitemap from part of my JCR. I am happy to iterate the JCR when first time creating it, but really don't want to re-iterate every time a request come in to pickup the latest content.

I would assume there is some thing like a listener to catch the change that have been made in the JCR where my sitemap generate from. If so, I only needs to update the sitemap file already generated, with some process with the changes has been caught by the listener.  Please advise if there is such listener and it would be great to advise some practical implementation. Thanks in advance.

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 edubey

Typically a sitemap is updated after 12hr or 24hr via a scheduled job which takes care of iterating JCR structure once and caching it in dispatcher till next version of sitemap gets generated by job.

Making changes in existing file might created overhead if these changes are large number also, I am not sure if updating sitemap as content changes will really create big impact for next few hours. (probably something you should consider)

All said..

ResourceChangeListener [1] event handler are preferred way as compared to JCR Event Handler

[1] https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/events/impl/SampleResourceChangeListener.java

2 replies

smacdonald2008
Level 10
January 18, 2018

"Like a listener to catch the change that have been made in the JCR "

AEM supports JCR NODE event handlers. That may be a way to proceed here. See the example here: acs-aem-samples/SampleJcrEventListener.java at master · Adobe-Consulting-Services/acs-aem-samples · GitHub

edubey
edubeyAccepted solution
Level 10
January 19, 2018

Typically a sitemap is updated after 12hr or 24hr via a scheduled job which takes care of iterating JCR structure once and caching it in dispatcher till next version of sitemap gets generated by job.

Making changes in existing file might created overhead if these changes are large number also, I am not sure if updating sitemap as content changes will really create big impact for next few hours. (probably something you should consider)

All said..

ResourceChangeListener [1] event handler are preferred way as compared to JCR Event Handler

[1] https://github.com/Adobe-Consulting-Services/acs-aem-samples/blob/master/bundle/src/main/java/com/adobe/acs/samples/events/impl/SampleResourceChangeListener.java