Move the button function to its own extension and include it only when Templating is present.