How to display chosen gadgets on Blogger Blog home page or label page

In some cases, you may want some specific gadgets to appear on the home page or label pages of your blog and not in post pages. For example, you would like your blog’s archives and labels to disappear  when visitors see a particular post. This article will describe how to show only relevant gadgets on your Blogger blog's home page.

Step 1: Sign in to your blog
Visit Google Blogspot home page at: http://blogspot.com/ or http://www.blogger.com/ and sign in with your Google account.

Step 2: Locate the id of your chosen gadget
When you sign in to your blog, you are presented with the main dashboard. You can then click 'Design' link under your chosen blog title.

Under 'Page Elements' tab, click 'Edit' link of your Blogger gadgets'. In the title text box copy it's title.

You can then click 'Edit HTML'. Tick the 'Expand Widget Templates'. Search for the title of your gadget.

By doing this you can know the id selector of your gadget. Your gadget code may look like the following:

<b:widget id='your_gadget_id' locked='false' title='your_gadet_lable' type='your_gadget_type'>
<b:includable id='main'>
  <b:if cond='data:title'>
    <h2><data:title/></h2>
  </b:if>
    ......
</b:includable>
</b:widget>

Step 3: Add condition for displaying the gadget on home page or label page
Add the conditional tag <b:if cond='data:blog.pageType != &quot;item&quot;'> to make your gadget appears only in the home page or label page of your blog. This tag should be added below<b:includable id='main'>. Then add the closing </b:if> tag above </b:includable>.

Your modified gadget code may look like the following:

<b:includable id='main'>
<b:if cond='data:blog.pageType != &quot;item&quot;'>
  <b:if cond='data:title'>
    <h2><data:title/></h2>
  </b:if>
    ......
</b:if>
</b:includable>

No comments:

Post a Comment

Blog Archive

About Me

My photo
I am a software developer with roughly 5 years of experience in developing end-to-end solutions in C#, Java, C/C++, PHP and HTML/CSS/Javascript. At the moment, I am joining the Professional Doctorate in Engineering degree program in Software Technology at Eindhoven University of Technology. My areas of particular interest include software design, data structures and algorithms, problem solving, software security, embedded system, machine learning, and data science.