update gallery_item template logic