I'm new here

Inculde the code fragment based on the section template usage

Hello All,

We would like to include the particular code fragment in the page template, if the page uses the specific section template.

Is this possible in the page template?

Thank you!

3 Replies
Crownpeak employee

As Developer I do not really understand why you would like to do this.
Is it not possible to add the desired functionallity to the section template you are using?

0 Kudos


I can imagine, you want to add CSS or JS for an image gallery only, if a gallery section is in the page. And the answer is "yes, you can". There are, as always, many ways to do so. First: do I understand you correctly? If not please clarify your use case.

Cheers, Heiko

0 Kudos


a usual way is something like the following code:


  #global.page.getChildren(class("de.espirit.firstspirit.access.store.pagestore.Section"), true).toList






Code to be output if there is at least one "active" section based on one of the given templates.


This version also supports multiple section uids. Of course you could write the same a little shorter by using a combined condition (&& instead of chained filter/map) but I prefer code like the above because I think it is better readable as it kind of describes the steps.

You could also start with !#global.page... and use isEmpty() at the end but that little ! is too easy to miss in my opinion.