Hello,
I'm trying to skip the component inclusion programmatically. The idea is to have some kind of business logic on server side that before the page composition, cycles on all components included in the page and can decide based on some condition whether or not include the components. I have been studying Sling Filters with COMPONENT scope but I couldn't find a way to actually skip the component inclusion.
Thanks
Stefano
Solved! Go to Solution.
Views
Replies
Total Likes
You can use data-sly-test/data-sly-include in the main .html of your component. That would work in any situation, static or dynamic.
The "problem" that I see with this approach is the client side library of your component. It would be part of the final .js/.css of your page no matter what.
Regards,
Daniel.
Views
Replies
Total Likes
I would use data-sly-test and data-sly-include
Views
Replies
Total Likes
Hi Feike,
thanks for your response! Would this solution work for pages where I don't have the data-sly-includes in the code, i.e. pages with parsys where I don't know which and how many components are included? The need is to cycle on components included in the page, regardless if that happens by drag & drop or "static" inclusion with data-sly-resource.
Thanks!
Views
Replies
Total Likes
You can use data-sly-test/data-sly-include in the main .html of your component. That would work in any situation, static or dynamic.
The "problem" that I see with this approach is the client side library of your component. It would be part of the final .js/.css of your page no matter what.
Regards,
Daniel.
Views
Replies
Total Likes
Not if you include your css/js in the header and footer of your page.
Views
Replies
Total Likes
Feike Visser wrote...
Not if you include your css/js in the header and footer of your page.
Yeah. I've thought something similar later.
I believe that the problem that I've described would only happen if you're using the same category for all your components...
If you have a different category for each one of them and an include instruction for each category (as part of the component code), you won't face that kind of problem.
Regards,
Daniel.
Views
Replies
Total Likes
Views
Likes
Replies