Class: Helper

helper~Helper(logger) → {Helper}

new Helper(logger) → {Helper}

Context helper. This is used to register properties to context of all decorated files, if you only need to register properties to context of a specific layout, you could do that while registering decorator.

Parameters:
Name Type Description
logger Logger
Source:
Returns:
Type
Helper

Methods

(async) getContext(site, file) → {Promise.<Object>}

Run all helper functions and gather context.

Parameters:
Name Type Description
site Site
file File
Source:
Returns:
Type
Promise.<Object>

register(name, fn, layoutopt)

Register a helper function.

Parameters:
Name Type Attributes Default Description
name String
fn helpCallback
layout String <optional>
null

If you want to run this helper function on a specific layout, pass it here as a filter.

Source: