Skip to main content

Gadget in mobile home page alone

We had a query in the forum on how to make a gadget appear only on mobile home page. So thought of sharing it.

Also Read: How to make a gadget appear only in Home page or the page you wish?


  1. Sign in to blogger.
  2. First Backup your blogger template.
  3. Go to Layout.
  4. Add a HTML/Java Script gadget that you want to make appear only in homepage of your blog and title it as homeonly(for qucik reference)
  5. Go to Dashboard > Template > Edit HTML.
  6. Press Ctrl + F and find homeonly. You will see a code as follows.
    <b:section class='main' id='main' preferred='no'>
    <b:widget id='HTML1' locked='false' title='homeonly' type='HTML'>
    <b:includable id='main'>
    <!-- only display title 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>
  7. Replace the code highlighted in yellow above, with the following codes respectively.
    1. <b:if cond='data:blog.pageTitle == data:blog.title and data:blog.isMobile'><data:title/></b:if> 
    2. <b:if cond='data:blog.pageTitle == data:blog.title and data:blog.isMobile'><data:content/></b:if>
  8. Now add a mobile='yes' as highlighted below so that the gadget actually appears in mobile template and the code in Step 5 will look as below.
    <b:section class='main' id='main' preferred='no'>
    <b:widget id='HTML1' locked='false' title='homeonly' type='HTML' mobile='yes'>
    <b:includable id='main'>
    <!-- only display title if it's non-empty -->
    <b:if cond='data:title != &quot;&quot;'>
    <h2 class='title'><b:if cond='data:blog.pageTitle == data:blog.title and data:blog.isMobile'><data:title/></b:if></h2>
    </b:if>
    <div class='widget-content'>
    <b:if cond='data:blog.pageTitle == data:blog.title and data:blog.isMobile'><data:content/></b:if>
    </div>
  9.  Save Template. You got it!
Now when you go to your blog on mobile template, the gadget will appear and on desktop it won't.

Comments

Post a Comment

Popular posts from this blog

How to connect any other profile in "About me" widget?

In this article I am going to tell "How to connect any other profile in "About me" widget along with blogger or Google+?"