Class CanonicalURLHandlebarsHelper

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

    @Component
    public class CanonicalURLHandlebarsHelper
    extends BaseHelper
    The {{canonicalURL}} handlebars helper is used to output the Canonical URL of the page being published.

    Usage

    The canonicalURL handlebars helper is used to output the Canonical URL of the page being published. This means that in the case of mirrored sections the URL of the source Section will be returned, instead that of the currently publishing mirror.

    Example

      <link rel="canonical" href="{{canonicalURL}}" />
     

    In the above example, the canonical URL for the publishing page is embedded as a link element.

    • Constructor Detail

      • CanonicalURLHandlebarsHelper

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