08 January 2009

How to Put a Widget on a Specific Page of your Blogger Blog



Widgets are short and handy small computer programs that can add more functionality to any Blog platform. In Blogger, where standard set of features and embedded plugins is rather limited, adding extended capabilities with third-party widget might help to spice up your blog and increase its attractiveness. It can be added as an extra code behind the new Page Elements through the Page Elements subtab of the Template tab.

In brief, to add widget or page elements to your blog login at Blogger.com and click on Layout link on Dashboard. Then click the Add Page Element link in the sidebar.

After adding a Page Element to your blog it can be seen on all your blog pages by default, unless you wrap the widget in conditional tags. In this publication, we will present you the way on how to put selectively widgets on particular blog pages. You really can decide on which pages or a single pagethe widget should appear.

WIDGET ON POST PAGES ONLY

If you want to put the widget only on the post (item) pages then paste this line :

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

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

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

For this login at Blogger.com and click on Layout link on Dashboard. Then click Edit Html subtab of Template tab. Put a check in the Expand Wdgets Template checkbox at the top of the Template code box and scroll down to the widget code. Lastly in the widget code add a </b:if> before the immediate next </b:includable>. This is how the whole widget code will look like after the change :

<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>

This widget will only appear on the Post Pages.

WIDGET ON MAIN PAGE ONLY

If you want the widget to appear only on the Main Page of the blog use the code below :

<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 the Main Page.

WIDGET ON SPECIFIC BLOG PAGE

There are some cases in which you may want the widget to appear only on a specific page of your blog. For example, there might be some pages on your blog with heavy traffic where you plan to put some special ads or particular content. Create the widget by pasting the HTML in the new widget. Then modify the code as shown below :

<b:widget id=’HTML1’ locked=’false’ title=’’ type=’HTML’>
<b:includable id=’main’>
<b:if cond=’data:blog.url == "BLOG_PAGE_URL"’>


WIDGET CODE

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


Replace the CAPS : BLOG_PAGE_URL with the permalink of your post.

WIDGET ON SPECIFIC LABEL PAGE

You can specify a widget to appear only on specific label pages. This is useful when you want to represent your labels with icons. For example, you may have posts on books and when the label books are clicked in your blog the sidebar will show a book icon. For such widgets, you can use the following 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 actual.
Source: http://betabloggerfordummies.blogspot.com/2007/12/put-widget-on-specific-page-or-url.html

1 comment:

LinkWithin

Related Posts Plugin for WordPress, Blogger...