Template variables and rendering context

Amagaki’s document route provider will render all documents configured with URLs. Binding a URL to a document means “render me as a page”. Documents without URLs are not built as pages.

When Amagaki renders a document, it selects a template (either the pod’s default template or a template bound to a collection), and renders it with the following context object.

Template variables

Here is the top-level rendering context available when templates are rendered:

doc

A reference to the current document being rendered. All properties of the document are available. Some commonly used ones are:

Read Document API Reference

pod

A reference to the pod. All pod functions are available from the pod object, which can be invoked from your templates. Some commonly used ones are:

Read Pod API Reference

process

The NodeJS.Process object.

req

The Express request object. Warning! This object is only available when using the server. The object is undefined when generating a static site.

route

A reference to the route binding the URL to the document. Some commonly used properties of the route are:

Read Route API Reference