Using the Blogger conditional tag will be easy if you have this cheat sheet handy:
Your standard conditional code will look like this:
<b:if cond='condition'>
content to display
<b:else/>
content to display otherwise
</b:if>
Or like this if you have no "else" condition:
<b:if cond='condition'>
content to display
</b:if>
You can also embed an if condition into another if condition:
<b:if cond='condition'> <b:if cond='condition'> content to display </b:if> </b:if>
So let's have a look at the complete list of available <b:if> tags:
For showing content only on static pages:
<b:if cond='data:blog.pageType == "static_page"'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content on each post page:
<b:if cond='data:blog.pageType == "item"'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content only on the homepage:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content on a specific URL:
<b:if cond='data:blog.url == "specific-URL"'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content only on posts with backlink:
<b:if cond='data:post.showBacklinks'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content only on posts with specific name:
<b:if cond='data:displayname == "specific-name"'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content only on posts with an exact number of comments:
<b:if cond='data:post.numComments == number'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content only on posts which allow comments:
<b:if cond='data:post.allowComments'>
content to display
<b:else/>
content to display otherwise
</b:if>
For showing content only on post which have a "read more" link:
<b:if cond='data:post.hasJumpLink'>
content to display
<b:else/>
content to display otherwise
</b:if>
No comments:
Post a Comment