Monday, 29 October 2012

Fix Blogger Gadget/Widget Display Only On Home Page or Specific

Fix Blogger Gadget/Widget Display Only On Home Page or Specific
Fix Blogger Gadget/Widget Display Only On Home Page or Specific
SET A GADGET ONLY APPEAR ON THE HOME PAGE ONLY FOLLOW BELOW STEPS:

1. Login to Blogger with your ID & Find Here Your Widget ID
2. Go to Blogger Dashboard.

3. Click Template.
4. Edit HTML >> Proceed >>
5. Find Your Widget ID that you Noted in Step 1 (don't click expand widget templates) then you got it below result after search.


<b:widget id='Text1' locked='false' title='Test gadget' type='Text'/>

6. Now Click on the Expand Widget Templates check box. After check the expanded template, find the widget name again. This time it will look a bit longer like below.

<b:widget id='Text1' locked='false' title='Test gadget' type='Text'>
<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>

7. Then add conditional formatting in above code.
Example:

<b:widget id='Text1' locked='false' title='Test gadget' type='Text'>
<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>

8. After Make Change save Your Template & check that the widget visibility.

DISPLAY A GADGET ONLY ON A SPECIFIC POST OR PAGE:
Follow exactly the same approach as above. But instead of

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

Make the conditional statement based on something else. This can be a different condition, or a specific page URL. For example to display a gadget only on a specific page, use this code, and put the address of the page instead of POST-URL:

<b:if cond="data:blog.url == "POST-URL"">>

To display a gadget on every page except a specifc one, replace the double equals signs (==) with the HTML code for not, which is an exclamation mark followed by an equal sign (!=). For example:

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

No comments:

Post a Comment

Here Comes the Hammer: The Tech Industry&#39;s Three Crises

The next few years are going to be extremely uncomfortable, and maybe disastrous, for the tech industry. Political opposition to the big tec...