/ Do you know how to write a hyperlink correctly? You might be surprised.

I recently covered proper URI design after which I was rightly chastised for not following my own advice. Now I’d like to cover their correct implementation via hyperlinks. Knowing how to correctly create hyperlinks is very important for several reasons, not the least of which being that hyperlinks are the most basic and foundational component of the web.

“In 1989, [Tim Berners-Lee] proposed a global hypertext project, to be known as the World Wide Web. Based on the earlier ‘Enquire‘ work, it was designed to allow people to work together by combining their knowledge in a web of hypertext documents.”–Longer Bio for Tim Berners-Lee

In keeping with my case for semantics I’d like to re-iterate that everything you type has a meaning—rather should have a meaning. So for example, in order to signal the end of a sentence, I’ll use the period character. Or if I want to signal a break in my line of thought, I’ll use the em dash character. Likewise, when I want to point a reader to a document on the web, I do it with a hyperlink. But in order to avoid confusion, I need to make sure that I do it right. Because, just as the misuse of punctuation and grammar can cause confusion, so can the misuse of markup. How often have you seen the click here hyperlink? It’s everywhere, and it’s the worst thing you can do. Let me explain. Take the following example:

<a href="http://arapehlivanian.com">
    Ara Pehlivanian

Semantically speaking, the example above denotes the following: create an anchor pointing to arapehlivanian.com and describe it with the following hypertext: “Ara Pehlivanian.” It doesn’t make much sense to describe a hyperlink using text that is in no way related to its hypertext reference (or href attribute), does it? Besides, well-written hyperlinks are a must when it comes to non-conventional devices such as screen readers that rely on a hyperlink’s hypertext for descriptive purposes. It’s also becomes important when your links are—for whatever reason—pulled out of context. If all you used as hypertext was the word “here,” imagine what a list of your links would look like. Reading it would make no sense at all.

Then of course there are search engines who regularly crawl and index the web. Whenever they encounter a hyperlink, they associate its hypertext with its hypertext reference. If the hypertext for the hyperlink doesn’t adequately describe its hypertext reference, you get strange results such as the now infamous “failureGoogleBomb. And though things like that may be mildly amusing, they certainly don’t help your search ranking.

You may need to rethink the way that you write copy in order to implement well-written hyperlinks, but believe me, the effort is well worth it.


Read more from the archive.