News!! Displaying A Gadget Alone On Static Pages - Or On Everything Except Static Pages

This article is close how to gear upward a gadget / widget inwards Blogger then that it is solely visible on the "static" pages inwards your blog.

In Blogger, the words "gadget", "widget", in addition to fifty-fifty "page-element" all hateful the same affair - basically a fleck of code that tin sack endure set into your weblog without looking similar code, in addition to which does a specific thing.

I mostly purpose "gadget", because the Page Elements tab currently says "Add a Gadget".  But they're absolutely the same.



Making a gadget that solely shows on static pages:


1   Make the gadget

Do this inwards the usual way.



two   Drag-and-drop the gadget to the identify where yous desire it

Influenza A virus subtype H5N1 pop identify for a gadget that is going to facial expression similar a "home page" is inwards the Body section, only inwards a higher identify the Blog Posts gadget, where "Test Gadget" is inwards this example:




three   Find the Gadget-ID inwards the usual way.


four    Find the code for your gadget in addition to edit the template:

Edit your template  inwards the usual way.

Look for the widget advert that yous noted inwards measurement 3.  Notice what comes later on it.   In this example, it's the describe for Blog1:
          <b:section class='main' id='main' showaddelement='no'>
<b:widget id='Text1' locked='false' title='Test gadget' type='Text'/>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'/>


Use the arrow at the left-hand-side of that describe to looks a fleck longer (the exact details depend on what type of widget/gadget it is.), similar this:

  <b:section class='main' id='main' showaddelement='no'>
<b:widget id='Text1' locked='false' title='Test gadget' type='Text'>
<b:includable id='main'>
  <!-- solely display championship if it's non-empty -->
  <b:if cond='data:title != &quot;&quot;'>
    <h2 class='title'><data:title/></h2>
  </b:if>
  <div class='widget-content'>
    <data:content/>
  </div>

  <b:include name='quickedit'/>
</b:includable>
</b:widget>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'>

five   Add conditional formatting:

You request to set conditional formatting code to a greater extent than or less the code for the gadget - making certainly that it doesn't larn to a greater extent than or less the code for anything else.

The code to purpose to set a gadget solely on a static page is:
<b:if cond='data:blog.pageType == "static_page"'>
THE CODE FOR YOUR GADGET GOES IN HERE
</b:if>

The event inwards a higher identify looks similar this, when the code has been added:
          <b:section class='main' id='main' showaddelement='no'>
<b:widget id='Text1' locked='false' title='Test gadget' type='Text'>
<b:includable id='main'>
  <b:if cond='data:blog.pageType == "static_page"'>  <!-- solely display championship if it's non-empty -->
  <b:if cond='data:title != &quot;&quot;'>
    <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>
<b:widget id='Blog1' locked='true' title='Blog Posts' type='Blog'>

ALTERNATIVES:

To halt a infinite beingness left for the gadget on other pages, alter the 2d code-block yous add together to:
<b:else/><style type='text/css'>#XXXX {display:none;}/*remove blank infinite that the gadget leaves*/</style></b:if>

instead of only    </b:if>


To brand the gadget appear on every page except static pages, use
<b:if cond='data:blog.pageType != "static_page"'>
THE CODE FOR YOUR GADGET GOES IN HERE
</b:if>
Notice the slight difference:    !=     instead of   ==

And of course of report at that topographic point are diverse other weather that yous tin sack purpose to command whether gadgets appear on certainly pages, too.     For example, the dwelling work solid page.

NOTE:  
Copy in addition to glue is the best means to transfer the code.  If yous must type it inwards yourself, endure very careful close what's a unmarried quote score in addition to what's a double quote mark.


half dozen    Check that it's worked

Preview your weblog earlier yous salvage the changes:  banking concern gibe that the the widget is visible.

Save the template changes, in addition to facial expression at your blog.  Check that
  • The widget is, or is not, on static pages (depending on what alternative yous chose)
  • The other elements of your weblog (other widgets, weblog post service titles, dates in addition to contents) are all equally yous facial expression them - on the get-go screen, in addition to on other screens too.




Related Articles

Static Pages inwards Blogger

Controlling what goes on the homepage

Showing a gadget solely on the home-page.

How to add together a gadget using Blogger

How to edit your blog's layout template

Subscribe to receive free email updates:

Related Posts :

0 Response to "News!! Displaying A Gadget Alone On Static Pages - Or On Everything Except Static Pages"

Post a Comment