only extract template once while rendering