Class FulltextHandlebarsHelper
- java.lang.Object
-
- com.terminalfour.publish.handlebars.helper.BaseHelper
-
- com.terminalfour.publish.handlebars.helper.content.element.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}} » {{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.
-
-
Constructor Summary
Constructors Constructor Description FulltextHandlebarsHelper(IPageAPI pageApi, IHandlebarsAPI handlebarsApi, IContentAPI contentApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
apply(Object context, com.github.jknack.handlebars.Options options)
Theapply
method is the main entry point for handlebars.java helpers.
-
-
-
Constructor Detail
-
FulltextHandlebarsHelper
@Autowired public FulltextHandlebarsHelper(IPageAPI pageApi, IHandlebarsAPI handlebarsApi, IContentAPI contentApi)
-
-
Method Detail
-
apply
public Object apply(Object context, com.github.jknack.handlebars.Options options) throws IOException
Description copied from class:BaseHelper
Theapply
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 interfacecom.github.jknack.handlebars.Helper<Object>
- Specified by:
apply
in classBaseHelper
- Parameters:
context
- The currently executing context.options
- The options.- Returns:
- The generated output.
- Throws:
IOException
- If processing of the expressions fails.
-
-