Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Sling Dynamic Includes and authored templates

Avatar

Level 2

We're trying to set up SDI on pages that use authored templates on 6.3 but aren't having any luck.  We have a user widget in the header that uses dynamic data but we aren't seeing anything happen in page rendering when we flag the header component as being an SDI resource type.  We are seeing includes being properly written when we indicate a component in the authored section of a page using that template, so we know SDI is set up properly.  Is there anything that needs to be done to get the two features working together?

18 Replies

Avatar

Level 2

We followed that, and we have it working for authored content in a page, but not any components authored in the template.

Avatar

Level 10

Have you looked at writing HTL component and using Sling Models- you should be able to create most types of components and these can easily be added to an editable templates via its policies.

Avatar

Level 2

We've created components, we've added them to our authored templates and they are working fine.  But when we try to designate the components in the template should be rendered through SDI its not working.  When we create a page using those templates the components we drop on the page that are designated as needing SDI are being rendered with the proper server side include tags.  So authorble templates are working,  sling dynamic includes are working, but we can't get them to work together.

Avatar

Level 10

I am not aware of any examples that show both of them working together. Most of the editable templates examples use HTL components - which is really best practice.

I will check internally to see if anyone has used these together.

Avatar

Level 10

Talking to some industry community experts - reply was: " some indirection between SDI + Editable Templates when it tries to load the template configuration could be responsible for the issue."

I would log a bug here,

Avatar

Level 2

Just an update, we've found that SDI works if the template component is unlocked, but not when it's locked.

Avatar

Level 4

I am also facing issue with locked component in editable template. Setting SDI on it is not working. I even tried an osgi configuration for template path with resource type of the locked resource. Do we have any solution for this issue?

Thanks,
Rajeev

Avatar

Level 10

Did you try above mentioned solution by Ben - "Just an update, we've found that SDI works if the template component is unlocked, but not when it's locked."

Avatar

Level 4

We can't unlock the component as it is the header/ footer for template. These needs to be fixed on template and authors should not be able to change it on individual pages.

Avatar

Level 10

I would recommend to test that it works when you unlock the template. If it works, then would you know the rootcause and the solution - it would essentially mean some kind or rep:write/jcr:versionManagement or similar permission issue on template node(s) which must be assigned to the service user used by SDI service. Write custom code to achieve it, if that's feasible.

Alternatively, as Scott mentioned above, open a ticket to SDI to get proper fix.

Avatar

Level 4

Hi gauravd83019631​ : It is working for unlocked components which are authored on the pages. Issue is with locked components. Where can we find the system user used by SDI?

Avatar

Level 10

I'll debug and let you know..

Follow the properties/behavior that change when you unlock the template. That should give you a quick start..

Avatar

Level 4

Cause

Extra SDI config needed for /conf folder.

Solution

* Add extra configuration for /conf folder.

* Add "ModMimeUsePathInfo On" to the VirtualHost in Apache so includes get processed on the first request.

Avatar

Level 1

I am using locked/structure component using editable template.

As I have used SDI on above component which uses 'currentPage' object in sling model to retrieve a custom page property. I've noticed that inject of 'currentPage' object in my sling models points to the the structure component page node while hitting via dispatcher. This injects the actual current page while hitting the page on publish instance. I guess this is since sdi is making a separate request from the original request.

Any pointers on retrieving the page property using the above configuration is much appreciated

Best Regards

Paul John