Web design & development

Website plugins/widgets/add-ons and standards compliance

Saturday 7 November 2009

One of the great things about popular website platforms these days is the often bewildering number of modifications and add-ons that are available to customise your website from the basic out-of-the-box version. However, if you’re concerned about making sure that your web pages are correctly displayed and don’t break people’s browsers – and you should be, otherwise you may be driving away traffic! – it pays to be a little bit careful about which add-ons you choose.

Generally, the basic version of a website platform – like phpBB (the popular forum software) or WordPress (the software that powers this blog and countless others worldwide) – generates standards-compliant code (most commonly HTML or XHTML) if it’s not tampered with. Many of the plugins or mods that are written to accompany them are carefully tested to ensure that they work properly within the basic version and don’t mince up the page code. But, on the other hand, many of them aren’t. And even with the ones that are, it may be that your server software exposes a bug that the original script author’s test server didn’t.

So be sure to go back and revalidate your pages whenever you’ve installed a new plugin, to make sure that they still meet the standards. It’s worth revalidating from time to tame anyway, even if you haven’t added any new plugins – your hosting provider may have updated the server software.

The World Wide Web Consortium (W3C) have several tools to help you do this – the most useful is their Markup Validation Service, but they also have one for CSS stylesheets among others.

Is your theme cramping your style?

Friday 4 September 2009

In our nine-step series about setting up a blog, we told you that the default WordPress theme would do for starters. This is true, as far as it goes. However, it’s very likely that after a while you’ll want to customise it more radically – or even replace it with another one – to make your blog site a bit more personal to you.

The WordPress default theme

The good thing about the default theme is that it’s very readily customisable – as long as you know what you’re doing with stylesheets and templates. Even if you don’t, there’s still plenty you can do with a little bit of help from the WordPress Codex – a collection of “how-to” guides explaining all about WordPress, including the various template files, functions, and features of WordPress that make it such a flexible blog writing tool.

The only slight annoyance we’ve found with it is when it comes to the stylesheet. As of WP2.8.4 the stylesheet divides elements into:

  • basic typography & colours
  • structure
  • headers
  • images
  • lists
  • forms
  • comments
  • sidebar
  • calendar
  • various tags & classes
  • captions

This is all very well, as far as it goes – at least there’s some kind of logical structure to it. Unfortunately, there’s a good deal of overlap. For instance, if you want to edit the attributes of a <h2> header in the sidebar, you have to look under “basic typography” if you want to change the font family, weight, size or colour, or under “headers” if you want to change its margins or padding. The one place you wouldn’t look is under “sidebar”.

So be warned – have a good look through the stylesheet before you start editing it, otherwise you may find that your style changes are superseded further down the page.

Other people’s WordPress themes

There are a host of free WordPress themes available for the cost of just a little time and energy spent searching for them. You can find nearly a thousand in the WordPress Free Themes Directory, but a search engine will throw up many more.

These themes are also customisable, of course. The same basic principles apply as for customising the default WP template. However, you may find that it takes less effort to work out how to amend the stylesheet – or considerably more!

Domain forwarding

Saturday 8 August 2009

Many website owners wisely buy related domain names at the same time as buying their chosen domain – after all, you don’t want your competitors to be able to occupy your space and benefit from misspellings and confusion between .com, .net, .org, .co.uk, etcetera.

Of course, you’ll be one of those wise website owners. But having bought the secondary domain names, you’ll want to make them work for you rather than lying idle. So the question arises: how can you set up domain forwarding on them so that your primary domain gets maximum benefit in the search engines?

Make sure you have permanent (Code 301) redirects

There are several ways of redirecting traffic, but the key point is to make sure that the redirect is handled as a permanent redirect (HTTP status code 301) rather than a temporary one (HTTP status code 302). Otherwise search engines may well penalise you for duplicate content – or at the very least fail to pass on link popularity from your secondary domain to your primary one.

Here’s a quick look at the various ways of redirecting traffic (from a *nix/Apache perspective – Windows servers have their own set of instructions):

Entry in your httpd.conf file

This is probably the neatest way of redirecting as it requires the server to carry out the instruction once only, rather than every time a page request is made. Unfortunately users of shared hosting are unlikely to have access to system files like httpd.conf, but your hosting provider may make the change for you if you ask nicely.

Entry in your .htaccess file

This is the second best option, and is probably good enough unless your secondary domain is attracting heavy traffic. You should be able to find the .htaccess file in your web root directory (often called “www” or “public_html”) – if not, make one and set the permissions to 644 (owner gets read-write permission, everyone else gets read-only). Then add this code:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.:]+\.)*secondarydomain\.co\.uk\.?(:[0-9]*)?$ [NC]
RewriteRule ^(.*)$ http://www.primarydomain.com/$1 [R=301,L]

Any URL at the secondary domain (eg www.secondarydomain.co.uk/mygreatpage.htm) will then be automatically redirected to the primary domain (www.primarydomain.com/mygreatpage.htm).

You can also do individual page redirects if you need to, but that’s a rather more labour-intensive process.

Registrar-provided URL forwarding

Many domain registrars offer you the facility to forward traffic from one domain to another. Unfortunately, they usually use a temporary redirect (Code 302) to do this, so you may dilute your link popularity.

Domain parking

You can get your secondary domain “parked” on top of your primary domain so that when people request www.secondarydomain.co.uk/mygreatpage.htm, they’re actually shown the content from www.primarydomain.com/mygreatpage.htm – although the URL in their address bar is still on the secondary domain. This can lead to search engines listing both pages for the same content (and has been exploited by spammers for that reason), so it’s not a great solution.

JavaScript meta-refresh redirects

You can include a JavaScript snippet in your page header to redirect to a given page within a specified number of seconds. This can be time-consuming to set up if you’re dealing with a lot of pages, of course. It’s also frowned upon by the search engines because people have abused it by creating optimised content for one topic, then forwarding to a page flogging blue diamond-shaped pills or such like.

Checking that it’s all working

Whichever method you choose, you’ll need to check that it’s working properly and that you’re getting Code 301 redirects. There are several server header checking tools around – just do a search and you should find one that works for you. Rex Swain’s HTTP Viewer works well.