Dynamically populate templates
Assign mode to env when building/previewing