1 Reply Latest reply on Jul 14, 2012 10:30 AM by AshishSPanwar

    Sitemap and caching

    danchapmanme Level 1

      We have a content page that uses the CQ Sitemap component. When a change is made to the site content hierarchy i.e. a page is added and activated the sitemap page is not updating. Is this normal?

       

      Should the sitemap page be updated or should we prevent the sitemap page being cached or something else?

        • 1. Re: Sitemap and caching
          AshishSPanwar Level 2

          I presume you are facing this issue when accessing sitemap page through dispatcher.

          The publish instance should be showing the results correctly.

           

          A few options to consider in case it is a dispatcher issue.

          1. Disable caching for sitemap page in the dispatcher configs (not very flexible though)

          2. Use ajax to load the sitemap content. This way you always get the latest content

          3. Use the dispatcher invalidation to make sure that on any page content updates, the sitemap page gets invalidated and on next request for sitemap a fresh sitemap content page is served from the publish instance.

           

          I personally prefer the 3rd approach. Since sitemap content doesn't change as often, the 3rd approach provides the benefit of making sure that the sitemap page is always updated and at the same time you enjoy the benefits of caching.

          You might want to read up on the dispatcher invalidation stuff first. I'm giving below a very simple example for this issue, solved through dispatcher invalidation mechanism.

           

          Suppose you have a site structure as follows:

           

          /content

               /sitename

                    /en

                         /home-page

                              /welcome

                         /marketing

                              /europe

                              /americas

                              /asia

                         /communications

                         /sitemap

           

          In your dispatcher if the invalidation level is set to '2', then any content activations under the /content/sitename/en tree will "invalidate" all pages under the tree. So if say, "europe" page is updated and activated out, from the dispatcher cache (same as webserver cache), the "europe" page would be deleted, and the "stat" file present in parallel to the "en" page would be updated (timestamp update). This simple timestamp update would effectively invalidate all pages under the "en" hierarchy. Please note that invalidated pages are not deleted from the cache.

          So the next request to any page under the "en" hierarchy would be served from the publish instance the corresponding dispatcher cache updated with the latest content.

          This way you can ensure that the sitemap always serves the latest content updates.

          In the above approach I have assumed the dispatcher invalidation level to be set to '2', which may be different for you based on your site structure and the invalidation strategy you follow.

           

          - Ashish