<% var thumbLink = typeof url !== "undefined" ? url : ""; %> <% if ( typeof permalink !== "undefined" && permalink ) { thumbLink = permalink; } %> <% if ( typeof thumb !== "undefined" && thumb && thumbLink ) { %> <%= thumb %> <% } else { %> <%= typeof thumb !== "undefined" ? thumb : "" %> <% } %>