You are on page 1of 3

Widget on Specific Page

http://amrihgunawan.blogspot.com

There are some case in which you may want the widget to appear or nor appear on a specific
page of your blog. The example because of loading access or some other reason.

Widget is the code to add page element, both in the side bar, header or in the footer. You can
add, remove or rearrange widget from sub-tab page element under Design-tab on the dashboard.

Your widget can be seen on all your blog pages unless you wrap the widget in conditional tags.
This mean that you can decide in which page your widget will displayed or not displayed

Displaying Widget on Main Page only


To do this, you need to insert this conditional tag:

<b:if cond='data:blog.url == data:blog.homepageUrl'>

immediately after the main includable line of code in the widget :

<b:includable id='main'>

and

</b:if>

before the immediate next </b:includable>.

The whole widget code after the change will look like this:

<b:widget id='HTML1' locked='false' title='' type='HTML'>


<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>

[Widget Code]

</b:if>
</b:includable>
</b:widget>

This widget will appear only on your blog's Main Page.


Displaying Widget on Post Page only
To do this, you need to insert this conditional tag:

<b:if cond='data:blog.pageType == "item"'>

immediately after the main includable line of code in the widget :

<b:includable id='main' var='top'>

and

</b:if>

before the immediate next </b:includable>.

The whole widget code after the change will look like this:

<b:widget id='HTML1' locked='false' title='' type='HTML'>


<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>

[Widget Code]

</b:if>
</b:includable>
</b:widget>

Displaying Widget on Specific Blog Page


To do this, you need to insert :

<b:if cond='data:blog.url == "BLOG_PAGE_URL"'>

Immediately after <b:includable id='main'>

and

</b:if>

before the immediate next </b:includable>.


The whole modified widget will look like this:

<b:widget id='HTML1' locked='false' title='' type='HTML'>


<b:includable id='main'>
<b:if cond='data:blog.url == "Page_URL"'>

[Widget Code]

</b:if>
</b:includable>
</b:widget>
You need to change Page_URL with your blog page permalink in which the widget will be
displayed.

Displaying Widget on Specific Label Page


You can specify a widget to appear only on specific label pages. For example you may have
posts on football or World Cup, and you want to embed some real time score update or league
fixture widget. For such widgets you can use this code:

<b:widget id='HTML1' locked='false' title='' type='HTML'>


<b:includable id='main'>
<b:if cond='data:blog.url ==
"http://BLOG_NAME.blogspot.com/search/label/LABEL_NAME"'>

[Widget Code]

</b:if>
</b:includable>
</b:widget>

Replace BLOG_NAME and LABEL_NAME with actuals