Class FulltextHandlebarsHelper

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

    @Component
    public class FulltextHandlebarsHelper
    extends BaseHelper
    The {{{fulltext...}}} handlebars helper is used in conjunction with fulltext pages.

    Usage

    The fulltext has two specific and distinct usage scenarios.

    Standard expression

    This usage scenario initiates the publishing of a fulltext page and returns a link to that page.

    Attributes
    • linkText - The text to be used in the generated link. If not set, this defaults to Continue reading....
    Example
      <p>{{{fulltext linkText="Keep reading"}}}</p>
     

    In the above example, a link to the fulltext page for the currently publishing content item will be generated.

    Block expression

    The second usage scenario is used to allow blocks to be processed depending on whether the page being published is a fulltext page or not.

    Example
      <div class="breadbrumbs">
       {{{nav id="23"}}}{{#fulltext}} &raquo; {{publish element="Name"}}{{/fulltext}}
      </div>
     

    In the above example a Navigation Object that outputs the path to the current Section is processed. After that, an additional handlebars block is processed only on fulltext pages. This block appends » <Content Name> to the end of the breadcrumbs.

    • Method Detail

      • apply

        public Object apply​(Object context,
                            com.github.jknack.handlebars.Options options)
                     throws IOException
        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.
        Throws:
        IOException - If processing of the expressions fails.