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.
See related posts:

Comments

Post a comment

Feeds for you

How to secure your Google account and Blogger blog?

As a part of contributions to NCSAM, I am writing this article down on what all should we be aware of with respect to Google's security aspect and how to make sure your blog stays yours forever.
What is NCSAM? It's National Cyber Security Awareness Month which is observed during the month of October every year in America.

However, we all know cyber security is a world topic and is not limited to just the USA. So let me give some tips with respect to keeping the Google account safe and Blogger blogs safe from hackers.

As I secure my account, I hope you people catch up too.

In this blog post, I am going to tell about the following,
Securing your Google account.Securing your Blogger blog. Securing your Google account Since Blogger is also part of your Google account, let's first see what all we need to do to keep our Google account safe. Don't share your password to anyone.Keep changing your password every 60 - 90 days.Make sure your password is strong enough. Have at leas…

Blogger custom domain confusions - Check before you buy

In the Blogger community forum, I happened to help a user who was not able to publish their blogspot address to their custom domain. After doing all the debugging, there was no option left out but to contact Google and finally we have known what the problem is.
The problem was that the URL was not available for use in blogger. 
Here on, before spending money on buying a domain, please ensure blogger allows it.
Why isn't the custom domain available to buy but not available to use on Blogger?
That'd be the first question every user would ask or think to ask. Unfortunately reason is un-disclosed by Blogger themselves. 
So how do we know if a domain is available at Blogger or not?
Earlier, there used to be no way we could do this as Blogger would throw a more generic error like below,

Now, we get a more customised error for this particular case alone like below,

So, here on, before spending money on buying a domain, please try publishing your blog in the domain name you are planning to bu…

Blogger in Draft says "Try the new Blogger!"

It's been long time that I wrote something here. Interestingly there seems to be a new update in Blogger in Draft (https://draft.blogger.com).