removed if logic from inside html tags and placed it inside a template tag