add hook to template renderiing.