Hello Readers, in this post we will learn how to use blogger
page type conditions to show or hide widgets on particular page type. Blogger
is one of the most used blogging platform around. I like blogger because you
have complete control over the template code. You can make customizations with
the template code, change the CSS style rules; customize the default widgets
and many more. Many CMS do not give these facilities to the free users and ask
for membership upgrade, but you can do all this even if you are not having a
custom domain name for your blogger blog that means you need not to pay
anything to avail these facilities. Sometimes you need to display or hide some
widgets/content on particular page type like to display ads only on posts page.
You can easily do it with the help of blogger page type conditions and later in
this post we will learn about page types in blogger and how to use blogger page
type conditions to show-hide widgets.
- Home Page: The page appears after a user enters direct URL of your site.
- Item Page: The page appears after the page jump or read more commonly known as Full post page.
- Static Page: Pages like Contact Us, About Us and Sitemaps etc.
Now that you have got a hint about the different page types
in blogger, we shall learn how to use page type conditions.
Note: Blogger templates are XML templates and follow a rigid
structure. To Use these page type conditions you need to edit your Blogger
template and it is recommended to take backup of your blogger blog before you
make any customization to it.
How to use Blogger page type conditions
Page type condition for homepage:
To show particular Code/Widget only on Home page you need to
enclose the specified code within the conditional code like this:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
Widget Code
</b:if>
Similarly to hide any widgets on Home page, write a code like this one:
<b:if cond='data:blog.url!= data:blog.homepageUrl'>
Widget Code
</b:if>
Example:
To fix duplicate Meta description tags for your blog you should enclose the Meta
description tag in the conditional code like this:
<b:if cond='data:blog.url == data:blog.homepageUrl'>
Meta Tag Goes Here
</b:if>
So that it will appear only on the home page because new blogger interface has
enabled the post descriptions as well which will lead to duplicate Meta
description tags. It is not good to have duplicate Meta description tags; it
affects the overall SEO of your blog.
Page type condition for Item Page:
You might have seen most of the widgets on this blog are
enabled only on the item or post page. I have placed social icons, ads and few
other widgets on item page only because it reduces the home page loading time.
To show any code/widget on Item or Post page use this code:
<b:if cond='data:blog.pageType == "item"'>
Widget Code Here
</b:if>
To hide any code/widget on Item or Post page use this code:
<b:if cond='data:blog.pageType != "item"'>
Widget Code Here
</b:if>
Examples:
- Social sharing buttons under post titles.
- Backlink widget under every blogger post.
- Show ads under post titles.
Page type condition for Static page:
Sometimes you need to disable particular widgets on static pages like comment
box or ads. You can easily do it with the help of the following codes:
To show any code/widget on Static page use this code:
<b:if cond='data:blog.url == "URL OF Selected Post"'>
WIDGET CODE
</b:if>
To hide any code/widget on Static use this code:
<b:if cond='data:blog.url != "URL OF Selected Post"'>
WIDGET CODE
</b:if>
These are the codes that you need to know for controlling
your custom widgets/codes on every page type. You can also apply same method to
show hide the default blogger widgets on particular page type. In the case of
default blogger widgets you need to place the page type conditions after the
<b:includable id='main'> of any default blogger widget but you need to
know the widget id first so that you do not hide any other widget mistakenly.
I hope I have made everything clear about the blogger page
types and their conditions in this article. But still if you face any problem
placing any page type condition comment here. I will be glad to help you.
You should also check out the blogger tips and tricks
section on our blog for more blogging and seo tips related articles. I am sure
it will improve your blogging experience.
If you like my work; you can show your regards by hitting
Facebook like button, following us on Google+ or Twitter, stumbling our posts
on stumbleupon or giving us a link back via the links below. Stay tuned for
more updates.
Do you like this post? Please link back to this article by copying one of the codes below.
URL: HTML link code: BB link code:
sir i created a blog on the subject delhiuptodate can you say how to get maximum people to visit my site. I have read your site but dont know how to make traffic sir can you help
ReplyDeleteDear first of all submit your blog and sitemap to the search engines like Google, Bing and Yahoo, then use Blog submission directories to submit your blog, use social media and youtube for promotions..I have written so many articles about blog promotions and traffic, follow them..
DeleteVisit our Blogger tips and tricks section ..There are so many articles that will help you generate a decent traffic..
please don't tell me like this i don't know how to submit site and site map to google, yahoo and bing
ReplyDeleteGive me your email id i will send you the posts link..
Deletesend to this mail favouriteteachers@gmail.com can u make a chance to chat with you sir
Delete