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 blogVisit 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
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 pageStep 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>
Add the conditional tag <b:if cond='data:blog.pageType != "item"'> 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 != "item"'>
<b:if cond='data:title'>
<h2><data:title/></h2>
<b:if cond='data:blog.pageType != "item"'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
...... </b:if>
</b:includable>
</b:includable>
No comments:
Post a Comment