Underscore conditionals and operations for this template?
<p>New to underscore. How do I write an "each" function for each post so that only the latest post is appearing? I know the logic is something like this  </p>

<pre><code>&lt;% _.each(posts, function(post, index) { %&gt;
&lt;% if(index % 3 == 0) { %&gt; 
</code></pre>

<p>But I only want the LAST post to show. In addition to that, I'm trying to figure out the logic I wrote in comments before each section, I'm having trouble trying to figure out the <strong>if/then</strong> logic code if ONLY an image appearing, if ONLY text, and then when if an image AND text appear together. </p>

<pre><code>&lt;!-- TEXT ONLY --&gt;
&lt;p&gt;&lt;%= post.message %&gt;&lt;/p&gt;
&lt;!-- /TEXT ONLY --&gt;

&lt;!-- IMAGE ONLY --&gt;
&lt;img class="imgonly" src="&lt;%= post.image %&gt;"&gt;
&lt;!-- /IMAGE ONLY --&gt;

&lt;!-- TEXT + IMAGE --&gt;
&lt;p&gt;&lt;%= post.message %&gt;&lt;/p&gt;
&lt;img class="imgtext" src="&lt;%= post.image %&gt;"&gt;
&lt;!-- /IMAGE + IMAGE --&gt;

&lt;!-- TEXT + IMAGE + LINK + LINK SUMMARY --&gt;
&lt;p&gt;&lt;%= post.message %&gt;&lt;/p&gt;
&lt;p class="link"&gt;&lt;a href="&lt;%= post.link %&gt;" target="_blank"&gt;&lt;%= post.link_title %&gt;&lt;/a&gt; - &lt;%= post.link_summary %&gt;&lt;\/p&gt;
&lt;img class="imgtext" src="&lt;%= post.image %&gt;"&gt;
&lt;!-- /IMAGE + IMAGE + LINK + LINK SUMMARY --&gt;

&lt;!-- IMAGE + LINK + LINK SUMMARY --&gt;
&lt;p class="link"&gt;&lt;a href="&lt;%= post.link %&gt;" target="_blank"&gt;&lt;%= post.link_title %&gt;&lt;/a&gt; - &lt;%= post.link_summary %&gt;&lt;/p&gt;
&lt;img class="imgtext" src="&lt;%= post.image %&gt;"&gt;
&lt;!-- /IMAGE + LINK + LINK SUMMARY --&gt;

&lt;!-- PLACEHOLDER --&gt;
&lt;p&gt;&lt;i&gt;There are currently no updates. Please check back soon.&lt;/i&gt;   &lt;/p&gt;
&lt;!-- /INITIAL PLACEHOLDER --&gt;              
</code></pre>