Tuesday, August 14, 2012

Blogger and valid HTML code

This article explains the issues faced by Blogger users who try to see if the HTML in their blog is valid - and why this doesn't matter in most cases.



What is "valid" HTML

If you read SEO advice or webmaster guidelines or web-best-practises, you should be told to make sure that the HTML in your website is valid.

Valid HTML is simply website code that totally meets the rules defined by W3C, the non-profit organisation that ultimately makes the rules about HTML and the other scripting languages that are used on the internet.

You can tell if the code on a site is valid by using a validator tool, like http://validator.w3.org/   - this is the best one, since it's from W3C:  if anyone knows whether something follows the rules, then they do.

But really, what is valid HTML/XHTML, and why does it matter?   Basically, it's code that meets all the rules and standards that have been decided for the current version of HTML, as at today.   It matters because web-browsers are written so that they correctly show information on screen if the code that is used to describe it follows the HTML rules.

However, as personal devices/computers and the web gets more sophisticated, the rules are enhanced so that browsers can do  more interesting things.   This means that code that was valid several years ago may not be valid today, because the rules have changed.


How to make the code in your blog valid

The short answer is that there is no way to force Blogger to generate valid code.

The slightly longer answer is that Blogger software makes your blog's posts and pages into web-site pages by combining:

You can control whether the code on your posts is "valid" - but only as far as Blogger's Post-editor lets you (eg it takes out <p> </p> tags and uses <br /> instead - this isn't regarded "good practise").

And you can edit your template to remove certain things that are not valid.

But no matter what you do, you can not remove all the "invalid" code that's generated by Blogger when your posts or pages are published, and you don't have the freedom to "clean" their code either:  Blogger provides us with free hosting and unlimited bandwidth - the price of this is that they impost some limits on what we can do with them.

So your overall site will not be valid accordingto the W3C rules.  There is nothing that you can do about this - and personally I don't think this will change any-time soon.


Is invalid HTML code really a problem:

At first glance, this may seem like a disaster - if Blogger won't make "valid" code, then we cannot use it to make blogs/sites that display properly, or that meet Google's own webmaster guidelines.

That's not quite right, though:  an important feature of the way browser-software and the internet work  is that browsers try to to work out what to do with HTML code that they don't understand (eg code that isn't valid any more, or code that's got new features that the brower doesn't support yet).  Instead of crashing, they make a best-guess about what to show on the screen, even though this might take them (a little) longer than showing valid code.

What that means for us Blogger-users is that our sites will be just fine most brower-software..

What's more, Google have promised that the  HTML which Blogger produces will work on the  most recent and last-most-recent version of the currently popular web-browsers - even though it's not "valid".

The only consequence is that our blogs may take a little longer to load, while the browser decided what to do with the "invalid" code - but in most cases, this extra time will be small compared to the time needed to load our pictures and gadgets, not to mention other cool things like Twitter messages or Facebook like buttons.

Of course, if you're a purist and hate "breaking the rules", then having an "invalid" blog may be more of a problem than you can bear.  But if you're realistic, you will notice that there are many, many fine sites made with Blogger, and this lack of valid HTML doesn't appear to be doing them much damage.


SEO and code-validity

In the early days of search-engine-optimization, people thought that having valid code would make it easier for Google and other search engines to look at and index your website - and this would make it do better in search results.

Initially, they may have been right.  But Google et al are pretty motivated to index everything - especially the blogs that their tools create.   And today, web-search "spiders" have become pretty clever about understanding web pages, no matter whether they're valid or not (or were valid before, or will be valid in future, etc)

In short, if you've been reading up about SEO and found a recommendation to "make sure your website code is valid", then I'd suggest skipping that advice, and spending your time worrying about more important things, eg that:

(*)  technically, the phrase is "key words" - and there are zillions of guidelines telling you how to choose "good" key words for your niche.   But  the simplest approach is to use version is "interesting" words, that people who are looking for your blog post are likely to use.



Related Articles:



Does search-engine-optimization matter for your blog.

Copyright, blogs and bloggers

Showing a picture on your blog

Understanding Blogger's Add-a-Gadget tool

Showing a working Twitter message in Blogger

Adding Facebook like, Send and Share buttons.

adsense
 
 
Copyright © blog
Blogger Theme by Blogger Designed and Optimized by Tipseo