Website coding books on shelf

Website Coding

Browser software such as Internet Explorer, or search robots don't see the web pages we view, they look at the source code used to build a page. Well constructed website code can ensure your visitors view your site as you hope, regardless of the browser they use. Leading search engines cope with coding errors fairly well but some errors can prevent good search indexing.

Google also look beyond the ability to index a page and consider the efficiency of website construction. If you are a Webmaster Tools user, you may have seen the Page Speed entry in the Labs section. Safe to assume site performance and therefore elements of coding are being factored into Google's ranking algorithm.

For those not familiar with website construction, choose the View option from your browser menu bar, then Source Code, or Page Source. You will see the code which maps out the visible page, suggestions for optimising source code are in the second half of this section, this part dealing mainly with creating the code.

Building Website Code

  • Being able to edit website code is a problem with many online creators, free sites, or WYSIWYG (What You See Is What You Get) tools. If you are stuck with a site which doesn't allow free access there may be partial options but given a choice, best to avoid them.
  • Using accessible HTML (Hypertext Markup Language) is ideal. Try to adopt the later XHTML (X for Extensible) which is a cleaner, stricter version and use that in conjunction with CSS (Cascading Style Sheets). CSS sets the appearance of a website and make changes throughout the site easier. Both code formats look complex but learning the basics is not too bad. Even if you need help to put together a site, understanding how to edit this will be an asset.
  • An alternative to hand coding is using a free CMS (Content Management System) such as Drupal, or Joomla, or a paid version. They have their place and appear tempting, users perceive an easy route for updating but they also have a learning curve. Issues in optimising a website for search or visitors can add problems, which need further knowledge. With control and flexibility available using XHTML and CSS they may be better, unless you have quite specific needs.
  • If you are using a designer, they should be able to build a site using clean, up to date code. If they suggest automated alternatives, make sure this is to fill your needs. Unfortunately, some people offering web design have learnt no more than how to use software to create a website.
  • Avoid the use of frames for a website and to a lesser extent, the tables format in HTML. There is little these can achieve that rational use of CSS would not, in a more accessible way.
  • Flash files and javascript have valid uses and search indexing has improved regarding Flash. Even so, they are better avoided if there are alternatives. You can lose a percentage of visitors and the desired effect is not always desirable, standard code can be as effective and better indexed.
  • Where possible use plain text navigation, or at least make a simplified version available on each page. In the same vein as the point above, this may assist a search robot in the task of collecting links and be better for visitors. Neither does using straightforward code mean navigation has to be boring, allying this with CSS allows many effects to be created.
  • Dynamic web pages are interactive pages, generated by a client side, or server side script, or both. Search engines will index dynamic pages, although performace can be less than optimal. If using standard, static pages is an option this may help.
  • Where you have a choice of building method, or choices within the one you use, opt for a situation that keeps URLs as simple as possible. CMS oddities, session IDs and content filtering can have adverse effects in search and be less clear for visitors. This includes potential visitors looking at search results, or anyone wanting to create a link to the page.
  • A caveat regarding the section above. Keyword URLs help a little in search but not so much, yet people change them believing they are vital. Unless you are confident on URL replacement, leave well alone and if you make changes, old URLs should be 301 redirected to the new equivalent.
  • Build navigation to be straightforward, although an absolutely flat layout is not always best. Adding categories containing their own pages helps search engines and visitors understand the site. Reducing navigation options could ensure visitors follow a path that helps them, together with the website's objectives. The aim is to provide clear guidance, for visitors, or robots.

This principle of clarity is the core of good website code. A site is created for two customers, visitors or search engines who bring them to you. Pleasing both with a simple approach doesn't mean your site has to lack appeal. If you would like more detail on helping your site, try our notes on common website errors.