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
deploy Run when site ready for deployment
post_deploy Run last (also after deploy scripts)

Tip

Run pagegen --init on empty directory and see hooks directory for examples. To use an example remove .example and ensure the script is executable.

Run one of the example hooks to see the available environment variables. All settings in the current site.conf environment are set, named PAGEGEN_<setting name>.

cd hooks
mv pre_generate.example pre_generate
chmod +x pre_generate
pagegen -g