Class 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
    • 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
        The apply 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 interface com.github.jknack.handlebars.Helper<Object>
        Specified by:
        apply in class BaseHelper
        Parameters:
        context - The currently executing context.
        options - The options.
        Returns:
        The generated output.