Documentation
¶
Overview ¶
Package template implements template rendering services for Monsti and Monsti content worker types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context map[string]interface{}
Context can be used to define a context for Render.
type Renderer ¶
type Renderer struct { // Root is the absolute path to the template directory. Root string }
A Renderer for mustache templates.
func (Renderer) Render ¶
func (r Renderer) Render(name string, context interface{}, locale string, siteTemplates string) (string, error)
Render the named template with given context.
name is the name of the template (e.g. "blocks/sidebar"). context is used as template context for rendering. locale is the locale to use for translation strings in templates. siteTemplates is the path to the site's overridden templates. If it's an empty string, Render will not search for overridden templates.
Render searches for nested templates to include in these files: <dir_of_template>/<template>.include <dir_of_template>/include <any_parent_dir_of_template>/include
Returns the rendered template.