Refactor extensions twig

Proposed fix for https://github.com/bolt/bolt/issues/2096