HTML Templates

Orb provides a templating engine that renders content based on provided assets that are expanded with data from an object. This typically would be used to produce rendered HTML to send to a web client.

Your templates can contain any arbitrary HTML (or any other textual content).

To include data from your Jade database in the HTML, you can decorate your templates with special directives that Orb dynamically expands. At runtime, the directive is replaced with the corresponding data.

When using directives to expand the templates with data from your system, an expansion object must be provided, which is the object from which the data is to be derived. The expansion object is provided as a parameter to the Orb@bind call or, in the case of embedded templates, it is a reference from the current expansion object that is passed to the embedded template, using an embedded template directive as summarized in the following table.

Directive Type HTML Element Description
Comment <## ##> Identifies comment text that is not expanded
Data <@@ @@> Expands to an object property
Internal <@@ orb-xxx @@> Special Orb directives
Executable <%% %%> Expands to the result of a method call
Embedded <$$ $$> Inserts another template inside the current template

You can decorate your templates with the following special directives that Orb will dynamically expand.