Content feed Comments Feed

Display Blogger widgets only in home page

Posted by Wonderful-Tricks
ADVERTISEMENTS

Display Blogger widget only in home page


Usually , widgets in Blogger blogs are displayed in all pages .For eg: , look at the Subscribe for Email Updates: widget on my right side bar . It is displayed in all pages of my blog . Now if you want to display Blogger widget only in home page , you have to edit your Blogger template with the following strip (in blue) of code . Here is HTML2 is my widget id for "Subscribe for Email Updates:".There may be different ids for different widgets .
In each case the following code should be added to make them fixed to the home page .

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



<b:widget id='HTML2' locked='false' title='Get Posts By Email' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != &quot;&quot;'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
</b:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>


Open your Blogger templates Layout and then Edit HTML
Click on expand widget templates . With Ctrl+F search for each widget with its ids or given label .
Now paste the code as specified and save your template . The edited Blogger widget would appear only in the homepage .

Note :
You can display Blogger widget in all pages except home page by altering above code(in blue) with this one .
<b:if cond='data:blog.pageType == "item"'>

Or you can display a Blogger widget only in a particular post page by changing it with following code .

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

So ultimately you have the total control over the postion of widgets in Blogger .

Your Ad Here

0 comments

Post a Comment

Blogumulus by Wonderful-Tricks

Followers