Class PreviewURLHandlebarsHelper

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

    @Component
    public class PreviewURLHandlebarsHelper
    extends BaseHelper
    The {{previewURL}} handlebars helper is used to output the preview URL of the page being previewed or published.

    Usage

    The previewURL handlebars helper is used to output the preview URL of the page being previewed or published.

    Example

      {{#preview}}
       <div class="t4-info">
         <span class="t4-channel">This is a preview of {{channelName}}</span>
         <span class="t4-publish-url">Page URL<br />{{previewURL}}</span>
       </div>
      {{/preview}}
     

    In the above example, if we're previewing the page, the Channel Name and Preview URL are published in a div element.

    • Constructor Detail

      • PreviewURLHandlebarsHelper

        @Autowired
        public PreviewURLHandlebarsHelper​(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.