Tags on page (not post) returns nothing – why? Improved clarified question!

I solved it. Should be using elseif($tag->slug) instead of elseif($tag->name) or else it will never be true.