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

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 profile confusions

Since Google has closed it's social networking service called the Google+ for consumers, few products has some effect on it. One of them is our very own blogger.

We could see that update notification in our blogger dashboard as below,



Besides from the things gone as mentioned in Blogger's official blog post here -> An update on Google+ and Blogger, we have a confusion on profile that needs to be clarified. That is the reason why I am writing this down.

There are now two profiles,

Blogger profileGoogle profileBlogger profile - Where does this appear?
This appears in all of your blogs if you have your profile gadget added. You can see that on this blog in the top right, How do I update this profile? Go to blogger.comNavigate to Settings > User settingsClick Edit under Blogger in User profile sectionYou'll be navigated to https://www.blogger.com/edit-profile.g where you can edit your profile that appears on the blog.Google profile - Where does this appear?
This appears in…

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).