Can anyone tell me the difference between Server side include and sling dynamic include and their respective use cases ?
The purpose of the sling dynamic includes (SDI) is to replace dynamically generated components (eg. current time or foreign exchange rates) with server-side include tag (eg. SSI or ESI). Therefore the dispatcher is able to cache the whole page but dynamic components are generated and included with every request.
The liferay-util:dynamic-include tag is an extension point for inserting content (e.g., JavaScript code, HTML, and more). To do this, create a module that has content you want to insert, register that content with the dynamic include tag, and deploy your module.
Sling Dynamic Include is actually a way of using Server Side Includes in Apache Sling (or CQ5). Whenever SDI finds an include, it will replace it with a SSI tag, so the include will be done by the http server and not by the sling engine.
There are some nice slides about that explains how it works. They provide a very nice use case for SDI, when you need to cache almost all a page but you still need to render a particular resource using sling, an 'account menu' in a otherwise static page, for example. There's also a blog post available with some more commentary than you can find in the slides.
One nice thing about them is that it is configured through the OSGi console, so you can turn if off (developers might not have Apache installed) or specify which resourceTypes includes to be turned into SSI
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With