125 Ad spot 125 Ad spot

G'day! Welcome...

So there's billions of pages on the Internet and you were unlucky enough to land on this one. Just kidding. This site is all about supplying information to beginner and intermediate SEO web developers. It also serves as a nice home for the SEO related plugins that I have developed. All comments and suggestions are welcome, so please stay a while or staaaay forever (mega cudos to those who remember the game).

5 November 2009 5 Comments

Bing and XHTML

http://markbeljaars.com/wp-content/plugins/sociofluid/images/digg_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/reddit_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/delicious_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/furl_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/technorati_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/facebook_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/mixx_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/twitter_48.png

It’s official. Microsoft loves XHTML compliant web pages! Well formed documents can be consistently displayed, searched, indexed, sorted and so on. Microsoft even entertained the idea of enforcing XHTML compliance in IE8. I guess it stands to reason that Bing will also prefer well formed web pages. If Bing becomes popular, it may be the catalyst used to sway developers to create well-formed XHTML web pages.

I therefore set out on a wonderful adventure to remove all XHTML errors and warnings from one of my sites.The finished error free page can be found at http://beginnerchess.org if anyone is interested.

Interestingly, I found three problems that would affect many people using Wirdoress 2.8 and above.

  1. Google adsense code snippets actually break wordpress. Wordpress converts the closing CDATA bracket to > (not >). To fix, remove the CDATA section and replace with comment tags. eg:

    google_script

  2. Also, the wordpress 2.8 search facility is not well formed. If you can be bothered, modify wp-includes/general-templates.php and remove any reference to role=”search”.
  3. Finally, make sure your theme has <ul> and </ul> tags around any calls to dynamic_sidebar (normally found in sidebar.php or functions.php files).

Also note that embedded flash files are not XHTML complient. There have been attempts to display flash using conforming tags, but I’ve found them not be reliable. Stick with non-compliant code for now.

To test your web page, visit http://validator.w3.org/

1 November 2009 2 Comments

A Cautionary Tale of Woe: The Bug That Got Away

http://markbeljaars.com/wp-content/plugins/sociofluid/images/digg_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/reddit_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/delicious_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/furl_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/technorati_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/facebook_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/yahoobuzz_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/mixx_48.png http://markbeljaars.com/wp-content/plugins/sociofluid/images/twitter_48.png

Last week I released an updated version of my Table of Contents Creator plugin for Wordpress. I pride myself in my coding, fault finding and testing abilities. That all came crashing down in one single night.

To cut a long story short, the new revision required a helper function to display post entries. The helper function was only called by one function and I therefore elected to include the helper function as a child of that function. This is common practise in many languages as it neatly packages all functions and their helpers in close proximity. The parent function by the way is called every time a page is displayed and terminates immediately if that page does not include the site map initiator tag.

Ok. Time passes. It is now 2am. The code is now ready to test. I know that the parent function exits immediately if it doesn’t find the initiator tag. This has previously worked, and I went nowhere near it, so it should continue to work. Right? I check the site map page, try out all the new and old options and prove that the code is working as intended. I quickly synchronize the SVN repository and rush off to bed to get some sleep before the sun comes up.

Next morning I decide to check a large site I know that uses my plugin. There’s no substitute for real world testing. Yeah, it all looks good. At that point I noticed a post in the site map that looked interesting. I clicked on the category link and was presented with the first post in the category and then a big nasty php error message. Mmm. I looked at another large site. Mmm. Maybe a coincidence. Lets look at one more. Oh no!

So what went wrong? Remember that child function? I’ve heard it said that kids can be evil and it turned out to be true in this case. If a blog page, category page, tag page or even a home page was displayed, multiple posts are shown on a single page. Wordpress does this by pretending that each post is a mini-page and links all the mini-pages together to form one large page. This means that my parent function is called multiple times. Normally not an issue. But now as the function contains child functions, these child functions are created each time the parent function is called (even if they are not used). Therefore, when then second post is displayed, the page crashes with a duplicate function name error message. The nett result was that a small bug in a seemingly unrelated function caused several very large websites to go down.

The morale of the story: if you are a website administrator, make sure you run the full suite of tests after every plugin update, no matter how big or small that plugin may be.