Gadgets and mobile templates
Previously I've described how to add a gadget to your blog.If you have not enabled a mobile template for your blog, then visitors who look at it using a mobile device (smartphone, tablet etc) will see all your content and gadgets. But they will probably have to scroll left and right a lot, because your blog will be a lot wider than their screen. There might be some issues if you have gadgets that require javascript or particular media players, which their device doesn't have installed. But these are exactly the same as the issues for your visitors who are using desktop computers.
But if you have enabled a mobile template, then readers who are using a mobile device see a different design which is tailored to their screen-width, though still using the colour/theme that you chose.
Blogger faced some challenged when they built these mobile templates: many bloggers put a lot of effort into design and providing gadgets that. But a 300-ish pixel screen simply does not have room for a sidebar and blog content, and may not have space for some of the things that gadgets do, either.
What Blogger have done is to say that only some gadgets are normally shown on mobile-template versions of your blog:
- Header
- Blog Posts
- Profile
- Pages
- AdSense
- Attribution
However it's easy to add other gadgets to your own customized mobile template, and to set up gadgets that are only seen by readers using mobile-devices - provided you are willing to take the risks of editing your template.
(I've described how to remove the attribution gadget from mobile-templates before, because it's one that some people particularly hate - and of course the same approach can be used for the other standard gadgets too.)
How to add a gadget to the mobile template
First, check that mobile has been enabled for your blog, and that your mobile template is set up to show customizations: go to the Template tab, click on the gear-wheel under mobile, tick Yes (for show mobile template), then select Custom, and press the Save button.Add the gadget to your blog, in the usual way: when you are choosing the parameters, make sure you think about the amount of screen-space that your mobile-readers will have to see it.
Find the gadget ID.
Edit your template: you don't need to expand the widgets.
Locate the gadget code, by searching for the ID you found (tip: use your brower's search function, eg ctrl/F). It will look something like this (slightly different, of course, if the gadget you are working on is of a different type):
<b:widget id='PlusBadge1' locked='false' title='Google+ Badge' type='PlusBadge'/>To show the gadget on the mobile version of your blog, add mobile='yes' to the code, like this:
<b:widget id='PlusBadge1' locked='false' mobile='yes' title='Google+ Badge' type='PlusBadge'/>
To show the gadget only on the mobile template and not to desktop users, add mobile='only' to the code, like this:
<b:widget id='PlusBadge1' locked='false' mobile='only' title='Google+ Badge' type='PlusBadge'/>
Save the changes.
Use either a mobile device (ideally), or another tool that lets you test blogs as they would appear on different screen sizes, to check that the gadgets are showing as you think they should.
Update:
Since first writing this post, I have found out that due to a bug in Blogger, if you have a gadget with mobile='only' set, then when you try to make changes to the blog using the Dashboard > Layout editor:- They will not save, and
- If you try to preview, you get an error message:
The template is updated in other place. Please reload the original page and retry it again.
Error 500
The only way I have found to get around the error is to remove the mobile='only' statement.
If you really want to have mobile-only gadgets, then you may need to:
- Remove the mobile='only' statement
- Make the Layout editor changes
- Replace the mobile='only' statement.
What gadgets should you add to your mobile template?
There are no hard-and-fast rules here: it's all about what you want your mobile visitors to be able to access. I have seen people add blog-rolls, linked-lists, polls, profiles, and various other simple widgets.Gadgets that I think could be more troublesome are slideshows, popular posts (if you try to show a thumbnail), newsreel, subscriptions, gadgets from Amazon.com and other 3rd parties.
You just need to remember amount of screen space which your visitors have, and how large the images are likely to be for them. And also that gadgets are likely to be shown as the bottom of the list-of-posts (which is how the blog-posts gadget shows the home page of your mobile blog), so won't be nearly so obvious as they are in the sidebar.
Why put gadgets only in the mobile blog?
You may wonder why a gadget should only go on the mobile version.One reason is to provide a simpler alternative to a full-featured gadget that is shown on the non-mobile version of the blog. For example, I use a two-page google-custom-search option here on Blogger-Hints-and-tips. This lets me control what sites are searched, and use some advanced display features. But a mobile-sized screen won't cope with this. So if I wanted to make Blogger-HAT more mobile-friendly, I'd add a regular search-gadget, but only show it to on mobile-devices so that non-mobile visitors didn't get confused.
Positioning gadgets on the mobile template
As far as I can see, Blogger users do not easily have any control over the positioning of gadgets in the mobile-template versions of our blogs.Some experiments make me think that:
- Gadgets from the header in the regular layout are put above the list of posts in the mobile view
- Gadgets from the footer in the regular layout are put below the list of posts in the mobile view
- Gadgets from the sidebar in the regular layout are put below the list of posts in the mobile view
But there could be more going on here - please let me know if you've worked out any more rules that are applied.
Also, I have no idea how mobile templates will cope with tricks like gadgets that are put above your header: test your blog extra carefully if you've tweaked your template in this way before adding mobile-specific tweaks.
Troubleshooting
Stopping gadgets from showing on mobile-template blogs (ie adding mobile='no') does not require you to choose the Custom option from the list of mobile template. But adding them (except for the ones in the default list) does.The default mobile gadgets are only shown if you have put them onto your blog template: if they are not in your blog at the moment, then they will not automatically be shown just because you enable a mobile template.
What other problems have you had with mobile-templates?
Related Articles
Putting a gadget into your blogTurning your blog's mobile template on
Advantages and disadvantages of editing your blogger template
Finding the id for any gadget
Adding a google-custom-search
Giving your blog a home-page
Adding gadgets to your mobile-template makes your blog better for smartphone visitors
4/
5
Oleh
jackcode
Berlangganan via email
Suka dengan postingan di atas? Silakan berlangganan postingan terbaru langsung via email.