|
One of the reader recently commented on my blog to know how I show some widgets on the blog main page and it hides away on the content or item pages. The answer of this I will say that I use Conditional Tags in my Blogger Template which gives "condition" to any widget that where to appear and where not to. I am using these conditional tags at many places in my blog.
So through this post I will teach you that how you can easily make use of these Conditional Tags in your template and easily play with the positions of your widgets :)
So first let me tell you the proper definition of Conditional Tags according to blogger.
Ok; so you got the definition now let's move on to How you can implement it.Implementation
First make sure to make a full backup of your existing template before attempting these Conditional Tags.
So before using these tags in your template; first just add any widget in your blog by the default way.
Now when you have added it Go to Layout > Edit HTML > Click on the Expand Box
Then search for any widget by the name which you have given it as title.
If you want to make an widget appear on main page only then we will use the following code:
<b:if cond='data:blog.pageType == "index"></b:if>
Now let me tell you how to paste it:
Place <b:if cond='data:blog.pageType == "index"> tag just after the opening <b:includable id='main'> tag and Place the closing </b:if> tag just before the closing </b:includable> tag.
If you want to make an widget appear on main page only then we will use the following code:<b:if cond='data:page.type == "item"'>
</b:if>
Now let me tell you how to paste it:
It's almost the same thing to do just replace <b:if cond='data:blog.pageType == "index">
with <b:if cond='data:page.type == "item"'>
from the above method.
By this method you can display any special widget on any special page which is important for it.
For this we will use the following code:
Just add <b:if cond='data:blog.url == "BLOG_PAGE_URL"'>
in the same way in the above mention methods just in this replace BLOG_PAGE_URL with the URL where you want the widget to appear.
By this method you can display any widget on any specific label page. For example you may have posts on books and when the label books is clicked in your blog the sidebar will show a widget which you have added specially for books.
For this we will use the following code:<b:if cond='data:blog.url == "http://BLOG_NAME.blogspot.com/search/label/LABEL_NAME"'>
</b:if>
Now let me tell you how to paste it:
Just use the above code i.e <b:if cond='data:blog.url == "http://BLOG_NAME.blogspot.com/search/label/LABEL_NAME"'>
in the same as we did for Displaying widgets only on homepage.
Here, replace BLOG_NAME with your blog actual name and LABEL_NAME with the label which is currently being used in your blog and where you want it to appear.
So I think you know the use of Conditional Tags and It's Implementation.Well if you have any problem then do ask me. You can also take my help in implementing it for free in you blog by my hands for which you just have send in your blogger info to my mail via contact form.
Image Courtsey: Bloggerbuster
Inspired by: BlogDoctor
Blogging Tips
What’s Next? : Don't Just Move Away... Wait! Say something by using the Comment Form below.My Blog is a Do-Follow so enjoy giving your comments and get backlinks from my PR3 blog.
Share and Enjoy!
Keywords : Cheap Domains, Make Money Online, Blogging Tips, Web Hosting, Blogger Templates
7 comments
Hi again!
Actually i was mentioning the ad that is in the post in this picture: http://daryl.simb.googlepages.com/adonpost.jpg
Anyway thanks for this tip. It helped me!
ohh..ok..By the way it's almost the same thing which I have used i.e Conditional Tags ;)
Hi again...
I seem to have problem making it. I don't know how. Actually I wanted to just put some ads at the top of the page, to make it look more nice. Would you mind if you give me the particular section of the code and so I could paste it on my blog?
I don't mind if I don't get any money, and anyway I didn't start this blog to earn money.
Thanks
@MK adida
Hey just send me the mail with your blogger account info and with the screenshot where you want put that thing plus the script code in a text file..I will do it for free :)
Is it possible to display a widget under "Post Pages with disallowed comments" only?
I think yes..
Post a Comment
Hello and welcome to Smart Bloggerz. I appreciate your comments and if you like what you just read you can subscribe here to get quick updates.
Also, My Blog is a Do-Follow so enjoy giving your comments and get backlinks from my PR3 blog.