You may want some individual gadgets to appear on a post page and not in the home page or labels page of your blog. For example, you would like your ad to appear only inside the content of the article when a post page is visited. This article will describe how to show relevant gadgets on Blogger blog post pages.
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
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 post pages
Add the conditional tag <b:if cond='data:blog.pageType == "item"'> to make your gadget appears only on the post pages. 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>
......
</b:if>
</b:includable>
<b:if cond='data:blog.pageType == "item"'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
......
</b:if>
</b:includable>
No comments:
Post a Comment