Class SectionLevelHandlebarsHelper
- java.lang.Object
-
- com.terminalfour.publish.handlebars.helper.BaseHelper
-
- com.terminalfour.publish.handlebars.helper.section.SectionLevelHandlebarsHelper
-
- All Implemented Interfaces:
com.github.jknack.handlebars.Helper<Object>
@Component public class SectionLevelHandlebarsHelper extends BaseHelper
The {{sectionLevel}} handlebars helper is a simple utility helper that outputs a number that represents how deep in the site structure the current section is - starting with 1 as the channel root.Usage
The {{sectionLevel}} handlebars helper is a simple utility helper that outputs the section level based on the channel root.
Example
- Home (Channel Root) - {{sectionLevel}} returns 1
- Child section - {{sectionLevel}} returns 2
- Grandchild Section - {{sectionLevel}} returns 3
- Child section - {{sectionLevel}} returns 2
-
-
Constructor Summary
Constructors Constructor Description SectionLevelHandlebarsHelper(ISectionAPI sectionApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Integer
apply(Object context, com.github.jknack.handlebars.Options options)
Theapply
method is the main entry point for handlebars.java helpers.
-
-
-
Constructor Detail
-
SectionLevelHandlebarsHelper
@Autowired public SectionLevelHandlebarsHelper(ISectionAPI sectionApi)
-
-
Method Detail
-
apply
public Integer apply(Object context, com.github.jknack.handlebars.Options options)
Description copied from class:BaseHelper
Theapply
method is the main entry point for handlebars.java helpers.It is called internally by the handlebars.java engine when a matching handlebars.java expression is encountered.
- Specified by:
apply
in interfacecom.github.jknack.handlebars.Helper<Object>
- Specified by:
apply
in classBaseHelper
- Parameters:
context
- The currently executing context.options
- The options.- Returns:
- The generated output.
-
-