10
votes

Can anyone tell me the difference between Server side include and sling dynamic include and their respective use cases ?

1

1 Answers

14
votes

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