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:
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"'>
</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 ==
"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"'>
</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 realtime 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"'>
</b:if>
</b:includable>
</b:widget>
Replace BLOG_NAME and LABEL_NAME with actuals
0 comment:
Post a Comment