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

Meet a spammer

Let me start by a warning, This blogpost has nothing to do with howtoblog and is a story of a spammer.

Years ago we had to face a spammer in the forum(Probably during Pistachio?) who was very persistent. He was a link dropping spammer who kept sharing his blog URL under every reply in the forum and somewhere to his blogposts which merely had instructions from Blogger Help Centre.

It went as,
Thanks and Regards,
HIS NAME
HIS BLOG URL Probably it was so difficult for TCs to make him go away as I happened to see him for months, spamming in the forum and one fine day he disappeared and never returned.

I happened to find him and interview him which I am writing down here,

Blogger Language Confusions

In BHF, we recently had a great confusion on Blogger Platform language and Blogger Blog language. So I decided to go ahead and write in detail about it.

There are two important terms here to begin with,
Blogger PlatformBlogger BlogBlogger Platform is what you see when you go to https://www.blogger.com. The operating system that helps you write and manage your blogs on Blogger.