Adding if statement in templates