One of the most common use cases in a website is to share or inherit content across all the pages. For example, a Header or Mega Navigation or a Footer and so on, the content of which will be same across all pages. The requirement is to author the content once and it should be reflected across all the pages. This should be designed in such a way that, the updates to the content should be seamless and also the caching should be efficient. While designing this, the first question in our mind will be:
How can I inherit this content across all the pages in a site?
Answer : This can be achieved by using experience fragments (XF) inside a editable template structure. The shared content can be authored inside an experience fragment and the same can be included in a template structure using the Experience Fragment Component. If you are using the latest maven aem-archetype, this configuration comes by default in the “Content Page” editable template.
If I update the shared content, I will have to clear the entire site cache. How can I avoid this? How do I cache it efficiently?
Answer : This can be achieved using Sling Dynamic Include (SDI). The Sling Dynamic Include not only allows us to serve highly dynamic content, but also allows us to cache a fragment of the page using the “html” extension.
Read Full Blog
Please use this thread to ask the related questions.