Destino Solutions

+91 9747866100

Hide/Show Widgets in Home/post/static/archive/search pages in Blogger

November 19th, 2013

Blogger (Blogspot) widgets or gadgets that you add on your blog will be displayed on all the pages by default, including the homepage as well.  hiding certain elements inside your blog pages is a best way to display whatever we like to express in different pages.


Blogger Conditional Statements can be used to control the display of HTML elements on certain pages or to set different styles for different Pages. Its really important to control widget Display in Blogger using Blogger Conditional Statements. Some widgets are meant for homepage only while some makes sense when you show it at your Contact Pages, About Me pages or static pages. Using Conditional Statements Is really Easy, We just need to enclose your widgets in few pieces of conditional statements.


UPDATE: Now you can use Conditional tags even for Mobile View.

Note:
Item Pages Include Posts only
Index Pages Include Homepage and Search/Label Pages
How to Show Widgets/HTML Only On Homepages?

Simply enclose the code inside HTML/JavaScript widget or template editor between these conditional lines,

<b:if cond=’data:blog.url == data:blog.homepageUrl’>
WIDGET CODE GOES HERE
</b:if>

where WIDGET CODE GOES HERE is the code of the widget you want to show or hide.

Hide Widgets On Homepages?

Same procedure here,

<b:if cond=’data:blog.pageType == “item”‘>
WIDGET CODE GOES HERE
</b:if>

Show Widgets Only On Static Pages?

<b:if cond=’data:blog.pageType == “static_page”‘>
WIDGET CODE GOES HERE
</b:if>

Hide Widgets On Static Pages?

<b:if cond=’data:blog.pageType != “static_page”‘>
WIDGET CODE GOES HERE
</b:if>

Show a Widget On a Selected Post Only?

<b:if cond=’data:blog.url == “URL OF Selected Post”‘>
WIDGET CODE GOES HERE
</b:if>

Hide a Widget On a Selected Post?

<b:if cond=’data:blog.url != “URL OF Selected Post”‘>
WIDGET CODE GOES HERE
</b:if>

Show HTML On First Post of Homepage?

If you want to show HTML content on first post of your homepage and not on every post that are displayed on homepage then use the following syntax,

<b:if cond=’data:post.isFirstPost’>
WIDGET CODE GOES HERE
</b:if>

Sometimes you would prefer showing a Featured or Latest ribbon image on the first post or you may wish to display some stuff only on first post summary, in that case you can surely enclose the HTML inside the above conditional statement.

Show Widget On Index Page?

Index pages include labels/search pages, archive pages and the Homepage. To show widget or HTML on these pages use the following syntax,

<b:if cond=’data:blog.pageType == “index”‘>
WIDGET CODE GOES HERE
</b:if>

Hide Widget On Index Pages?



<b:if cond=’data:blog.pageType != “index”‘>
WIDGET CODE GOES HERE
</b:if>

Show Widget On Search Page?

Search Page in Blogger blogs include all Label Pages and search pages displayed when a user searches a query using the search box. To show widget or HTML on search pages use the following syntax,

<b:if cond=’data:blog.searchLabel’>
WIDGET CODE GOES HERE
</b:if>

Do the same for applying any pages you have. I hope this will be helpful 🙂

Categories: BloggerBlogger Widget