Created
July 19, 2012 13:55
-
-
Save jshaw/3144083 to your computer and use it in GitHub Desktop.
Underscore.js template conditional example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If URL is available URL link the image | |
// Otherwise just display the image | |
<% if ( instagram_link_url ) { %> <a href="<%= instagram_link_url %>" target="_blank"> <% } %> | |
<img src="<%= url %>" alt="<%= username %>" /> | |
<% if ( instagram_link_url ) { %> </a> <% } %> | |
// Example 2 - Check if formated date | |
<% if (typeof(date) != "undefined") { %> | |
<span class="date"><%= date %></span> | |
<% } %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment