Show Content Only On the Post Page in Blogger

Or show Content when there is only one post. I've been fiddling with Blogger for a while now and studying how to code using the bloger tags. This took me a few weeks to figure out but finally, I guess I'm getting more comfortable with it.

<b:if cond='data:numPosts == 1'>

<!-- PUT CONTENT HERE -->

</b:if>

 

How is this used? This is used for example, you want to show a facebook "share this" content and only want to show that particular link or button when inside a blog post

 

To do that, you do it like this... Put this inside the

      <!--Share of Facebook-->
      <b:if cond='data:numPosts == 1'>

      <div>
&lt;a name=&quot;fb_share&quot; type=&quot;button_count&quot; expr:href=&quot;http://www.facebook.com/sharer.php?u=data:post.url&amp;t=testtitle&quot;&gt;Share&lt;/a&gt;
&lt;script src=&quot;http://static.ak.fbcdn.net/connect.php/js/FB.Share&quot; type=&quot;text/javascript&quot;&gt;
&lt;/script&gt;
      </div>

      </b:if>
      <!--Share of Facebook-->

 

The <script> tags were actually converted so they would fit into blogger.

 

See it in action here (the facebook share button):  http://game-rumble.blogspot.com/2010/04/transformers-online-game.html

Published 04-08-2010 2:37 AM by lamia