Blogger mobile

Do you use Blogger? Need a mobile template? We recently had a request in our forums for a mobile template for Blogger, and a few searches later ('blogger mobile template' etc.) and I knew how to post to a Blogger blog from my phone, but not how to make it accessible to mobile users…

Blogger uses a template system which allows users to create and customise their own templates. I decided to try my hand at producing a mobile template – requirements were that it should be mobi compliant, and should score 5 on

Mobile template

Blogger logoSo, starting with the default template, the plan was to whittle it down. I immediately ran into a problem: the blogger NavBar. This is automatically inserted by the Blogger engine, in an iframe, at the top of every blog. Frames are a big no-no! Even in the desktop world they are shunned for accessibility, and in the mobile world its even worse – some phones will degrade gracefully, but others will explode, harming their owners. (Of course, mobile browsers are becoming more tolerant…) So it was absolutely necessary to get rid of this NavBar. Its not configurable (at least I couldn't see that it was)and it looked like it was a blocker.


Blogger navbar


However, it turned out to be a little easier than expected. There is a weakness in the Blogger template parsing engine. To insert the NavBar, Blogger simply searches for the first occurence of the <body> tag in the template. However, it doesn't check for validity, and more importantly, it doesn't ignore comments (in the way that they should be ignored) – it *appears* to simply look for the first occurence of the string '<body>'.

So the solution:
Include the following line:

before our 'real' <body> tag.

And Blogger magically turns this into:


Ok, so there is going to be some dead weight in this markup, but this is a far lesser evil than the iframe.

Valid Markup

The other main requirement was Valid XHTML Mobile Profile – so we score a 5 in

First thing to do here is ensure we are using the correct DOCTYPE. This is the easy part – just include the following DOCTYPE at the top of the template:

Of course there is a bit more to it than just adding a DOCTYPE. We need to make sure that we are only using XHTML MP tags, and that we are using them correctly, only using permitted attributes etc. So to ensure that our template was Valid XHTML MP, I fixed everything I could by hand, and then iteratively tested in to check for validation errors. The Blogger engine inserts snippets of markup here and there, so some things are beyond our control – if it couldn't be fixed it I dumped it. As a result there are probably some things (e.g. comments) which could go back into the template if some more time was spent on it.

Blogger be mobile

The Template

So at the end of this, we have a mobile template. Its of the one-size-fits-all variety in that there is no device detection, or adaptation. You will get the same thing whether you visit on your desktop, your iphone, or your wristwatch. It relies on a hack, which Google/Blogger could fix at anytime. And there is no image processing/adaptation to ensure only smallish images are published. But, we have met our main requirement, that it is mobi-compliant and scores 5 in

Now to a question that might make this template useful – is content adaptation possible?

Well, there is the Blogger API, which allows you to do all kinds of interesting interesting dynamic things with your template. Maybe there is something that would let us do adaptation. It turns out there are conditional constructs, but sadly, though not wholly unexpected, there was nothing that would help us identify the client, such as providing access to HTTP headers, (which would have pretty much solved the problem). So it seems that device detection wouldn't be possible at the server.

Another way to acheive this would be through the use of CSS media types to give a different exeperience to desktop and handheld devices (watch this space)

Bad blog

Does Blogger need mobile template support?

So back to the original question – what are Blogger users doing for their mobile audience? Does Blogger need device detection?

You decide.

The image on the right is a screenshot from a big name blogger site, and one that really should know better: at a whopping 402KB, I don't think this is what I wanted on my phone… can you guess who it is? Free mobile template for anyone who can identify it 😉

Template markup is included below. To install login to your Blogger account, click the 'Template' tab, and then click the 'Edit HTML' tab. Replace the current template with the markup below. (You should probably back up your old template)


Exclusive tips, how-tos, news and comment

Receive monthly updates on the world of mobile dev.

Other Products

Market leading device intelligence for the web, app and MNO ecosystems
DeviceAtlas - Device Intelligence

Real-time identification of fraudulent and misrepresented traffic
DeviceAssure - Device Verification

A free tool for developers, designers and marketers to test website performance
mobiReady - Evaluate your websites’ mobile readiness

© 2024 DeviceAtlas Limited. All rights reserved.

This is a website of DeviceAtlas Limited, a private company limited by shares, incorporated and registered in the Republic of Ireland with registered number 398040 and registered office at 6th Floor, 2 Grand Canal Square, Dublin 2, Ireland