Class SnippetHandlebarsHelper

  • All Implemented Interfaces:
    com.github.jknack.handlebars.Helper<Object>

    @Component
    public class SnippetHandlebarsHelper
    extends BaseHelper
    The {{{snippet ...}}} handlebars helper allows a developer to directly target the Section Meta Content using the specified Content Layout.

    Usage

    The snippet handlebars helper allows a developer to directly target the Section Meta Content using the specified Content Layout without the use of any Related Content Navigation Objects.

    Attributes

    The snippet handlebars helper has one required and one optional attribute.

    • layout - This attribute is required. It tells the helper which Content Layout to use.
    • use-current - This attribute is optional. By default, the snippet handlebars helper uses the Section Meta Content in it's evaluation context. If this attribute is set to true then the currently processing Content Item will be used instead of the Section Meta Content. It should be noted that in this scenario, the Content Layout is still loaded from the Section Meta Content Type.

    Example

       {{snippet layout="text/description"}}
     

    In the above example, the Section Meta Content is processed using the text/description Content Layout.

    • Constructor Detail

      • SnippetHandlebarsHelper

        @Autowired
        public SnippetHandlebarsHelper​(IPageAPI pageApi)
    • Method Detail

      • apply

        public String 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.