Hooks

To make the static site more dynamic(pun intended) Pagegen can run executables (hooks) at preset times, during the generation process.

To enable a hook make the appropriate hook file executable (chmod +x hooks/hook_file).

Available hooks
Name Description
pre_generate Run before generation starts
post_generate Run when generation complete
pre_generate_page Run before page generation starts
post_generate_page Run when page generation complete
post_deploy Run last, if deploy_mode set

Hooks are run with the following environment variables. Non zero exit from a hook immediately aborts generation.

PAGEGEN_BASE_URL
Base url setting, available all hooks
PAGEGEN_ENVIRONMENT
Name of environment being generated
PAGEGEN_SITE_DIR
Pagegen root directory, available all hooks
PAGEGEN_SOURCE_DIR
Content directory (/content), available all hooks
PAGEGEN_TARGET_DIR
Generated site directory (/site), available all hooks
PAGEGEN_PAGE_TITLE
Page title, available *_page hooks
PAGEGEN_PAGE_URL
Page URL, available *_page hooks
PAGEGEN_PAGE_SOURCE_PATH
Path to page source, available *_page hooks
PAGEGEN_PAGE_TARGET_PATH
Path to page target, available *_page hooks