Unintentionally Blank

Phil Nash on the Internet, Web Standards and Accessibility

Semantic Header Markup Means Search Engines Will Understand Too

May 01, 2007

by Phil Nash

I was going to write a post on how using semantically correct markup for your post titles would improve the accessibility of your page, impress the meaning of your content to both readers and search engines and generally add to the level of well-being in the world. Sadly for me, Chris Pearson got there first with his post, The Definitive Guide to Semantic Web Markup for Blogs. The other unfortunate thing is that he probably did it better than I would have done!

Flattery aside, the article really does hit the spot. Header elements are not to be used for presentation and selecting the size of font you use for a particular word, they convey the hierarchy and meaning behind each heading and subheading and should be used like that. Recently I changed my post titles on their single pages from <h2>s to <h1>s as I realised that the title of my post is the most important part of the page, not the name of my blog. I do have my own tip as well, so I wrote this post instead.

Titles Are Seen More Than You Think

Chris points out that the <title> element appears not only at the top of your page, on tabs, in bookmarks, etc. but is weighted quite heavily in search algorithms and appears as the link in search engine results. Even the W3C calls it the "most important element of a quality web page".

So how do you create that perfect title? In my opinion, you need to put across the content of the page in it's title. In the case of a blog, what better way to do that then use the post title. If it is the homepage then the name of the blog and the tagline seem like a logical choice. If you navigate this site, you will see how I display my titles -- Post Title :: Unintentionally Blank. This allows people to read what the post is about rather than repeatedly reading my blog name if there are a number of links to my blog. I have done this with the following code:

<?php
wp_title(' ');
if(wp_title(' ', false)) { echo ' :: '; }
bloginfo('name');
if (is_home()) {  echo ' :: '; bloginfo('description'); }
?>

If you add this to you <head> section your blog will display the page title if you are on anything but the front page and your blog name and tagline on your main page, just like mine.

Improve Your Site

So go forth, read Chris Pearson's article, tweak your theme and play with how you use headers, I am already planning to add my tagline to my <h1> on my front page, try out my Wordpress title method and watch the targeted search results come in, whilst feeling smugly satisfied because you have improved your markup not employed some dodgy tactic to lure people in. Drop me line or leave me a comment if you need any help.

Unintentionally Blank is Phil Nash's thoughts on web development from 2006-2008. Any code or opinions may be out of date.