Home » , » Add a widget/gadget only for homepage, posts - blogger tutorial

Add a widget/gadget only for homepage, posts - blogger tutorial

How to add a widget (adsense ads, links, follow) home page or post page only? Also learn the way to set up widgets for specific posts or in category. This tutorial is also for blogger blog makers.

Usually, by default.. when we add a widget item like link units, profile, Archives, Adsense ads,Pictures,etc in Blogger blog , it will be displayed in every page of the blog including the homepage, Permalink pages,etc.But as you want to show your facebook like page, follow me page, blogger slide show, adsense ads etc for a particular post, or only for your homepage or only for your post pages. You have to change your blogs entries manually. But it is not so hard. Follow me and act as I'm doing ....

HOMEPAGE Only widgets,links in Blogger:

→ As usual, if you want to add a new widget/gadget to your blog, just Sign into Blogger dashboard » Layout » Add a Gadget
and select the type of gadget you need and Save the Changes.

Next, we have to add a small piece of code to that widget, so.. it only displays in the Homepage. Just go to Edit html and tick on the 'Expand Widget Templates'.
Notes: Normally, the widgets in the template view starts with this one

<b:widget id=

For example, The label widget looks something like this:

<b:widget id='Label1' locked='false' title='Title' type='Label'>

and html widget looks like:
<b:widget id='HTML1' locked='false' title='' type='HTML'>

and link list looks like this:

<b:widget id='LinkList2' locked='false' title='Title' type='LinkList'>

(If you want to know exactly what the widget id you need to change, just go to your blog and view the source code and find it.
In Firefox : View » Page Source
In IE : View » Source )

Just below that widget id link, You can see a b:includable tag like this..

<b:includable id='main'>

At this point, most of the task is completed.. Just we have to add a small piece of code below that b:includable tag..

the code is
<b:if cond='data:blog.url == data:blog.homepageUrl'>
and the last thing is, we have to close that b:if tag. Just add this code before the closing tag of b:includable.
Like this:
</b:if>
</b:includable>

So, the final code looks similar like the below screenshot:

Finally it looks something like this
That's it! and Don't forget to Save the Changes.
Now, your desired widget/gadget can only be visible in Homepage.

Showing in only Post Pages (Permalink pages):

This will allow you to show a specific widget in only the Post Pages and not in the Homepage.
Just follow the same tutorial above but replace this code.
<b:if cond='data:blog.url == data:blog.homepageUrl'>

with this one:

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

Showing Widgets on a Specific Blog Post url:

If you want to dispaly a specific widget on on a particular blog post, just simply follow the above tutorial, but replace this code:

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

with this one:

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


That's it!
Like this post or have any questions? Comment here..

© Taken From

2 comments:

Post a Comment