Much of the built in functionality in Sitegen is implemented by plugins. You can create your own plugins to add custom functionality to the various steps of building the site. A plugin is implemented as a MoonScript class. Functionality is injected into the build by implemending certain properties or methods. The Plugin Lifecycle describes what happens to a plugin when Sitegen builds the site.
mixin_funcsis copied to the site’s config scope. These methods can be called from
site.moon, they are bound to the instance of the plugin
type_namematching a value in
is_aare called via the
on_aggregatemethod. The current page is passed to the method as the first argument
tpl_helpersis made available to be called in any template, the methods are bound the instance of the plugin. They will also receive an instance of a page before any arguments passed to the method.
writemethod are called. The
writemethod is called with no arguments. This is when a plugin can create any necessary side effect files
site scope: the object that represents the function environment that is
used when running the initialize function. The
mixin_funcs property on a
plugin is used to extend this scope.
template scope: the object that holds all the fields available to any
template rendered for that page. The
tpl_helpers property on a plugin is used
to extend this scope.