Add hook for template write.