Add folding to templates