Once you activate any widget, in your blog, it will be displayed in all the pages by default, including your homepage.
But sometimes, we do want to show some widgets only on Homepage or only for the individual posts pages, or only in a specific page, the coding is quite simple, but you need to customize the widget through the "Edit HTML" link in your "Layout" section.
Follow these steps:
Create any widget, and place it where-ever you want, and save the template. Check if it is working (should be displayed in all the pages). Remember to give a TITLE to it, like Archives/BlogRoll/Maps/Clock, anything unique.
Now go to "Edit HTML" page.
Click/mark "Expand Widget Templates"
Then find for that unique Title (by searching through CTRL+F method)
It will be something like this:
Now tweak this as follows
To display the code only in HomePage
To display widget in "All Posts", but NOT in HomePage
To display widget in any specific page
But sometimes, we do want to show some widgets only on Homepage or only for the individual posts pages, or only in a specific page, the coding is quite simple, but you need to customize the widget through the "Edit HTML" link in your "Layout" section.
Follow these steps:
Create any widget, and place it where-ever you want, and save the template. Check if it is working (should be displayed in all the pages). Remember to give a TITLE to it, like Archives/BlogRoll/Maps/Clock, anything unique.
Now go to "Edit HTML" page.
Click/mark "Expand Widget Templates"
Then find for that unique Title (by searching through CTRL+F method)
It will be something like this:
<b:widget id='HTML3' locked='false' title='UNIQUE WORD OR TITLE HERE' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
Now tweak this as follows
To display the code only in HomePage
<b:widget id='HTML3' locked='false' title='UNIQUE WORD OR TITLE HERE' 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 != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>
To display widget in "All Posts", but NOT in HomePage
<b:widget id='HTML3' locked='false' title='UNIQUE WORD OR TITLE HERE' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'><!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>
To display widget in any specific page
<b:widget id='HTML3' locked='false' title='UNIQUE WORD OR TITLE HERE' type='HTML'>Add those code lines in red color, as per your requirement.
<b:includable id='main'>
<b:if cond='data:blog.url == "SPECIFIC_BLOG_POST_URL"'><!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if></b:includable>
</b:widget>























18 comments:
thank you very much
i tried for display widget in "All Posts", but NOT in HomePage but all the widgets are also showing at homepage. :)
I implemented it to show a widget only on homepage in the crosscol section of my testblog and it works great.
Thank you very much. This is just what I'm looking for.
:)) The second Version is not working. . guess to show on all page except homepage
Well dude, I have myself used all these hacks, and they have worked well in my blogs, make sure all the code work is in correct place...
Great tweaks to hang around for blogger's ..
Thanks for providing this useful tricks...
Welcome Fasil !
Thanks a lot for providing this extra ordinary tweak...
Thanks for the tips. Hi all, please remember to replace " with "&
Hi Swanie, about which of the 3 hacks are you talking about ?
Tnx again Divya Sai
I have a question, Does Widget(Contain Text Only) Slows your loading time of blog?
If yes
{
What if I used only "To display widget in any specific page"
Does it slows my HOMEPAGE? or the only specific pages I choose?
}
If No
{
Can I Spam it? assuming text are easy to load
Your HTML cannot be accepted: Tag is not allowed
so I will use c language
like this
if(data:blog.url == "blog.com/title1)
{
Text:title 1
}
if(data:blog.url == "blog.com/title1)
{
Text:title 1
}
}
I hope you will answer my questions. tnx
If you are considering only text/simple HTML widgets, then you need not have to worry about SEO/loading time as text is very light & easy to load, but if there are pictures/videos or javascript etc., in the widget, then it will of course delay the loading time.
Now if you use widgets to display only in certain pages(eg. homepage), then it will not slowdown your other pages...
I used it and it works very well
It is very useful like your FEATURED CONTENT
TNX
i want to hide the social bookmarks from the homepage but i have done the coding in the html layout now what's the UNIQUE WORD OR TITLE of it..
how can i hide them without knowing its title
i want to hide the social bookmarks from the homepage but i have done the coding in the html layout now what's the UNIQUE WORD OR TITLE of it..
how can i hide them without knowing its title :((
You do not need the unique word now, simply add the code for bookmark buttons between the code required to hide them from the homepage,
Read this comment:
Read More
And for the social bookmarking buttons code, you may read this post:
Social Bookmarking Buttons
it works as a charm !
i search &alt;b:widget id then i add the codes in red and it works. the widgets are only shown in pages i wants, but there is a very small rectangle in their place.
another 100% working hack, thanks divya :|
i give a name to every widget in order to find in in the HTML code, then i erase the names and let it blanc ;;)
thanks, helped me!
Allowed HTML tags: <b>, <i> and <a>