If we call template() outside of this defined resource, then we can't use its variables in the template. Let's make things simpler, get the template path as a parameter, and call template() on it here.