Top 5 Ways To Keep Your WordPress Blog Valid (And Why It Matters)
Posted on Wednesday, May 9th, 2007
Making your blog look good and work well is a major consideration of anyone who wants to do well in the blogosphere. Making sure your blog is valid and adheres to the standards of the W3C will ensure that your theme will look good in all browsers, even those yet to be released, be more accessible, easier to maintain and easier for search engines to crawl. So how do you go about making sure your site sticks within the guidelines?
A Great Base
One of the best things about WordPress is it’s commitment to web standards.
Key Features
Full standards compliance — We have gone to great lengths to make sure every bit of WordPress generated code is in full compliance with the standards of the W3C. This is important not only for interoperability with today’s browser but also for forward compatibility with the tools of the next generation. Your web site is a beautiful thing, and you should demand nothing less.
So WordPress endevours to display valid code at every step. Then there are themes. Any theme designer that’s worth anything will make sure their themes are valid (X)HTML and cross browser compatible to fit in with the ideology above.
So how do you stop your theme from falling apart, causing hundreds of errors in a validator and becoming harder and harder to look after? I have noticed a few common mistakes in the (X)HTML of many blogs that I have visited, so here are a few tips on how to stay valid.
5 Tips And What Might Happen If You Don’t Follow Them
- Add
altattributes to all your images. - Whether it’s an image in a post or a button on your sidebar, you need to include the alternative text. Without it, your blog is invalid and users who can’t view images won’t know what was supposed to be seen. The
altattribute is also useful as a bit of extra search engine optimisation, if youraltattribute describes the image and the image is relevant to your post, then there are more keywords available for the search engine bots to feed on. - Adding the alt attribute:
<img src="image.gif"
alt=”Short description of image” /> - Close all your elements.
- In HTML it was OK to write paragraphs as follows:
But in (X)HTML this no longer works, you need the all important </p> at the end of every paragraph (or the </li> after list items, or </ul> after lists, the list goes on). Not only will sticking to this make your code clearer to read, but not closing elements properly can mess up any javascript on the page too! So those paragraphs above should look like this:
<p>Some text here in the first paragraph...
<p>Second paragraph here...
<p>Some text here in the first paragraph...</p>
<p>Second paragraph here…</p>
- Self close those single elements.
- It’s all very well closing paragraph and list elements, but you can’t forget line breaks (
<br />), images (<img src="image.gif" alt="example" />), links (<link rel="stylesheet" type="text/css" href="style.css" />).
They all have one thing in common, the trailing/>. Make sure you include it too. - Make your lists behave.
- WordPress uses lists a lot! Most sidebars are unordered list after unordered list, for the semantic and accessibility factors they provide. All too often this can be spoiled by an out of place paragraph or div or even another list. For example:
Just rememeber, whenever you are between an
<ul>
<p>Out of place paragraph.</p>
<li>The real list</li>
</ul>
<ul>and an</ul>you must also be between a<li>and a</li>. - Embed videos properly.
- I’m not one for video blogging, or even dropping in the occasional YouTube video, but many bloggers do and embedding flash content is hardly ever done correctly. For a start the
<embed>element has never been supported by the W3C, it was made up by Netscape in the days of proprietary browser HTML. The way to do it is using the<object>element. I’m no pro, but there are two articles on embedding flash at A List Apart that clear things up.
So there you have it, 5 things you can watch out for to keep your blog posts and your theme valid. While they seem harmless now, when browsers move on the standards will stay the same and the valid and well constructed sites will last.
If there is anyway I can help and point out where your theme could be fixed up, please let me know and if there are any other tips you can give for keeping a site valid, please do share.
Update: Please check out my next post for an easy and quick way to check whether your pages are valid.
This post is part of the ProBlogger group writing project. If you have written a top five post, I look forward to reading yours too.
If you enjoyed this post, why not subscribe to Unintentionally Blank
Pingback by Top 5 - Group Writing Project Day 3
May 10th, 2007 at 10:17 am
Pingback by Group Writing Project - Day 3
May 10th, 2007 at 10:32 am
Pingback by Some good posts I managed to read today
May 10th, 2007 at 12:34 pm
Pingback by Top Five Group Writing Project: Day 3
May 10th, 2007 at 12:57 pm
1May 10th, 2007 at 1:36 pm
Duncan Says:Thanks for this Phil. As I started using the XHTML tests provided by Wordpress I discovered a few of these things. I haven’t worked out how to keep the Blogshares widget in XHTML compliant code. Any thoughts?
Pingback by ear sucker » Blog Archive » Group Writing Project Day Three
May 10th, 2007 at 2:43 pm
2May 10th, 2007 at 4:44 pm
Randa Clay Says:Thanks for this Phil. I’ve never really taken the time to completely understand this, so I appreciate this post.
Pingback by Group Writing Project - Top 5 Day 3 | Techie Buzz
May 10th, 2007 at 4:53 pm
Pingback by Group Writing Project - Top 5 Day 3 : WinonBet.org
May 10th, 2007 at 6:26 pm
3May 10th, 2007 at 6:40 pm
Phil Says:Duncan: I’m afraid I don’t know the Blogshares widget. If you could show me an example I’ll have a go though!
Randa: No worries! There are obviously lots more points to it, but these are the most common that I’ve seen. If you want any further tips, drop me a line!
Pingback by Everyday Randomness » Group Writing Project Update
May 10th, 2007 at 9:29 pm
Pingback by Travis Eneix » Some Pyramid Schemes are Nice
May 10th, 2007 at 10:08 pm
Pingback by Everyday Randomness » Top 10 Group Writing Project Entries
May 10th, 2007 at 11:53 pm
4May 11th, 2007 at 4:53 am
blogjunkie Says:Hi, I’m the blogjunkie from myMacBUZZ. I’ve been looking for an automatic validation monitoring system instead of having to check the W3 Validator every day. Do you have any suggestions?
Check out my entry for Darren’s group writing project too.
Pingback by The Easiest Way To Check Your Site’s Validity :: Unintentionally Blank
May 11th, 2007 at 8:39 am
5May 11th, 2007 at 9:36 am
Phil Says:Hi blogjunkie, thanks for commenting.
Your comment actually reminded me of something I was going to put at the end of this post, but left out in the end. Here is how to validate your blog easily.
Pingback by The resourceful webdesigner’s toolkit. — BlogoSquare
May 11th, 2007 at 1:35 pm
Pingback by Top 5 Group Writing Project
May 11th, 2007 at 5:43 pm
Pingback by Perfection Consulting » Blog Archive » The Power of Linking
May 11th, 2007 at 7:34 pm
Pingback by Top 5 Group Writing Project: And the Lucky Winner Is? | aczafra.com [Librarianship with a dash of everything]
May 12th, 2007 at 7:47 am
Pingback by Jestertunes » Group Writing Project Full List
May 12th, 2007 at 11:48 am
Pingback by Two Dog Zoo Travel » Blog Archive » Group Project Brought in 800+ Entries!
May 12th, 2007 at 7:16 pm
Pingback by Randomness: 893 Top 5 Lists… | Photography and Art, Mostly…
May 13th, 2007 at 12:49 am
Pingback by Top 5 Group Writing Project Is Now Complete
May 13th, 2007 at 2:35 am
Pingback by Some link love to fellow Group Writers | Blogging Notes
May 13th, 2007 at 7:33 am
Pingback by Madhur Kapoor’s Blog » Problogger’s Group Writing Project - All entries
May 13th, 2007 at 4:46 pm
6May 13th, 2007 at 11:43 pm
Nyssa Says:Some excellent tips there, even for me. I think even those that generally know what they’re doing tend to forget to close tags and such. It’s not hard to do.
Great article, Phil. :)
Pingback by ProBlogger - Top 5 - Group Writing Project - Link Love » twentythree7
May 14th, 2007 at 1:45 am
Pingback by Problogger.net Top 5 Writing Project Final List - Plus6 …a personal finance blog
May 14th, 2007 at 3:25 pm
Pingback by Juice on Celebrities, Celebrity Gossip, TV, Movies, & more… » Blog Archive » Top 5 Lists
May 15th, 2007 at 3:59 am
Pingback by Quais Waseeq Dot Com » Top 5 Group Writing Project - Recap
May 16th, 2007 at 10:29 am
Pingback by A million top 5’s
May 17th, 2007 at 12:36 pm
Pingback by Randomness: 893 Top 5 Lists... | Photography and Art, Mostly…
June 10th, 2007 at 6:28 pm
Pingback by Things you should know when using the div element — BlogoSquare
June 22nd, 2007 at 5:21 am
Pingback by Joseph Szymanski | Photographs | » Blog Archive » Randomness: 893 Top 5 Lists…
August 18th, 2007 at 10:51 am
Pingback by Useful WordPress links.
August 20th, 2007 at 1:21 am
Pingback by Group Writing Project - Lista Final - Rockerspace.net
October 19th, 2007 at 4:02 pm
Pingback by A surefire way to get links and traffic for your blog » All Tips and Tricks
November 5th, 2007 at 12:55 pm