Embrace the doctype…

Written on 05 August, 2008 by Jonathan Crossfield
Categories Web Design & Content

I’ve come across a lot of sites lately that don’t have a document type declaration, or, a doctype. Not having a doctype will prevent the site from validating which is important for search engine indexing. Browsers can be quite forgiving when displaying a poorly coded site, for example, unclosed tags or no quotation marks, however search engine spiders are not as understanding. Something as simple as forgetting to close off a tag can cause a spider to not index text or a link.

The first step in validating your site is to make sure you have a doctype declaration on every page. Below is an example of the most recent version and the most widely accepted by modern browsers.

<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

Once this has been implemented, you will now be able to run a validation on your site via the w3.org website. This will give you a rundown of all the coding errors your site may have or, if you’ve coded everything correctly, a seal of approval stating your site is standards compliant (which is always looked upon favorably by search engines).

The most important reason why every site should have a doctype is the fact that it makes a lot of guessing with browsers unnecessary. Using an incomplete or outdated doctype or no doctype at all, throws the browser into “Quirks” mode, where the browser assumes you’ve written invalid markup and code and can alter the way your website renders on screen.

As a rule of thumb, adding a doctype should be the first step in building a standard’s compliant and SEO friendly website. We should all embrace the doctype…

Looking for some help with domains, hosting, web design or digital marketing?

Send me marketing tips, special offers and updates