Hyperlinks

Linking between pages

The specification (RFC 1808) is not exactly readable. However, for now you will just have to work from the following examples:
  • To link from anywhere to the home page, use
    href="/".
  • To link from a page like http://www.britgo.org/tournaments/publicity.html to http://www.britgo.org/tournaments/ use
    href=".".
  • To link from a page like http://www.britgo.org/tournaments/2003/mk.html or http://www.britgo.org/tournaments/2003/ to http://www.britgo.org/tournaments/, use
    href="..".
  • To link from a page like http://www.britgo.org/tournaments/ to http://www.britgo.org/tournaments/publicity.html, use
    href="publicity.html"
  • To link from one part of the site to another, for example, to link from anywhere which is not in the results area, to the results or a particular tournament, use something like
    href="/results/2003/mk.html"
    (that is, start with a slash to get you to the top level, and work from there).
  • To link within one part of the site, for example, to link from http://www.britgo.org/results/2003/mk.html to http://www.britgo.org/results/2002/mk.html, use
    href="../2002/mk.html"
    (that is, work up as few levels as necessary using .., then work down again).
  • Named anchors within pages

    These are used sometimes to be able to reference to a section of a page. That is, having <a name="fred"> in one place, and <a href="#fred"> or <a href="pagename.html#fred"> in another. The <a name="fred"> should go inside any block-level element, and just surround the text. That is should look like this:
    <h2><a name="britc">British Championship</a></h2> Not like this:
    <a name="britc"><h2>British Championship</h2></a> In theory, it should be possible to do:
    <h2 id="britc">British Championship</h2> But this sometimes fails to work in Netscape 4.X. Since there is a not much more complicated method that does work, please use the
    <a name="britc"> form. Note that the rules for forming names are:

    name tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

    However, the recommendation is to stick to letters and digits. The punctuation characters cause problems. (Underscores are a problem in CSS, the others in JavaScript. If you absolutely must use one, use a hyphen.)

    Link Text

    When putting a link on the page, you should make the text of the link (that is, the words in the sentence that the user must click on to follow the link) meaningful. The classic bad example is:

    To find out more about the BGA, click here.

    ‘Click here’ gives absolutely no clue about where this link goes, which makes skim-reading the page to find a particular link much harder. That is bad. It gets worse: for a blind or partially sighted using a screen-reader to access the site, this sort of thing makes the site almost unusable. Then, to add insult to injury, the sentence uses the word ‘click’. That assumes that the reader is using a computer with a mouse, which is not universally true. Where possible, avoid assumptions like that. If you must instruct the user, tell them to ‘follow’ the link, or ‘go to’ the page that the link points to (or synonyms). They will know the appropriate procedure for following links with their set-up. Now for some good examples:

    There is another page giving the results of British go tournaments.

    Based on the ratings FAQ explains this table, and how to use the information it contains.

    [The BGA] also has a selection of promotional material for use by Go clubs and at publicity events.

    If you plan to take children to a Go tournament, you should read the BGA policy on working with children and young people.

    Writing sentences so that there is a sequence of words that can naturally be used as the text of the required link is something of an art. It is not always easy, although it does get easier with practice. Sometimes you have to be prepared to completely reorder the sentence to make it happen. If you are stuck, it often helps to ask another person. I am always happy to be asked about this sort of thing.

    Punctuation and links

    The rule here is that almost all punctuation goes outside the link. If the link is at the end of the sentence, or before a comma, the full stop, exclamation mark, comma, or whatever, goes outside the link. This applies even if the link forms an entire sentence. If a link is in brackets, then the brackets go outside the link. However, it only a part of link text is bracketed, those brackets go inside the link.

    Worked examples

    Example A

    For example, Simon Goss asked my about three examples from the policies page.

    Not so good: (Simon’s comment: Naff repetition.)

    3. Working with Children & Young People

    See BGA Policy on Working with Children and Young People.

    Better: (The sentence now at least conveys some other information, the fact that a policy exits as a separate document, as well a repeating the title. That seems unavoidable, since the policy has a good clear name that describes exactly what it is.)

    3. Working with Children & Young People

    The BGA has a separate Policy on Working with Children and Young People.

    Example B

    Not so good: (Simon’s comment: Ungrammatical construction.)

    The BGA provides facilities for distributing tournament entry forms with the newsletter and hosting them on the BGA web site. These facilities and many other recommendations are described in Publicising Go Tournaments.

    Better: (Nothing wrong with putting the link at the start of the sentence.)

    The BGA provides facilities for distributing tournament entry forms with the newsletter and hosting them on the BGA web site. The page Publicising Go Tournaments explains how this works, alongside other recommendations for tournament organisers.

    Example C

    Not so good: (Simon’s comment: Stilted workaround to avoid ungrammatical constructions.)

    The official version of the rules for the British Go Championship, the British Pair Go Championship and the British Youth Championships is the BGA Championships Rules page.

    Better:

    The BGA Championships Rules page contains the official rules for the British Go Championship, the British Pair Go Championship and the British Youth Championships.

    Checking Links

    Web sites have an unfortunate habit of changing, which means that links to other people’s web sites that used to work fine have a habit of breaking. Therefore, you should check all the links on the pages you are responsible for periodically.

    It would be very boring if you had to go and manually click on all the links yourself. Fortunately, you don’t have to. There are any number of computer programs to automate the process.

    The webmaster normally uses the W3C link checker. Go there, type in the URL of the page you want checked, and click on the ‘Check’ button. It is a very thorough checker, so if it finds no problems on your page, you can be happy. However, if it does find some problems, you will discover that it has a bit of an attitude problem! Its error messages are fairly forthright, some might even say rude.

    However, if using the checker as above is too much trouble, you can make the process simpler. In your web browser, create a bookmark/favourite called something like ‘Check links’, and with location/address/URL:

    javascript:(function(){location.href="http://validator.w3.org/checklink?uri="+escape(location.href)+"&hide_type=all&depth=&check=Check"; return 0;})()

    (Don’t worry, you don’t need to understand that. Just copy and paste it into the location/address/URL field of the bookmark). It can be quite difficult to create a bookmark from scratch. The secret is to bookmark a random page, then find that bookmark, open it's properties dialog box, and then edit the various bits.

    Once you have set that up, go to any web page you like, then open that bookmark, and you should find that it checks the links of the page you were just looking at. Magic! The webmaster finds this so convenient that he keeps it on his personal toolbar.



Last updated Fri Dec 21 2012. If you have any comments, please email the webmaster on web-master AT britgo DOT org.