Hyperlinks, specifically Anchor elements
From the html specification: “A hyperlink can have one or more hyperlink annotations that modify the processing semantics of that hyperlink.”
The important part of that statement is processing semantics : these annotations are there to provide additional guidance to programs that consume the page, not humans using the Mark 1 eyeball
The spec defines this in 4.6.8 Link types – and for this discussion, I’m only looking at <a ...> elements.
These annotations are given in the rel attribute, and are a space-separated list of terms.
Traversables
Before we start on these annotations and what they mean, we need to understand a concept in the HTML spec documentation: “Traversables”
As you browse the web, you collect a whole bunch of documents and referenced data – creating a trail of history and vaguely linked documents, which you can Navigate through. When you open a new browser window, or a new tab in an existing browser, you create a new (blank) navigable.
A Traversable navigable is the currently active set of history et al data…. essentially, the currently active tab – for us visually-oriented people
The importance of this becomes apparent when creating anchor links with target attributes.
- If you do
<a href="foo">foo</a>, this simple replaces the current page with the new page…. and adds to the current Traversable navigable. Lets call this the “same context”
- If you do
<a href="foo" target="_blank">foo</a>, this leaves the current page alone and opens the page in a new window/tab – it creates a new Traversable navigable stack (there’s no “history” to go back to the calling page). Lets call this a “new context”
- If you do
<a href="foo" target="somename">foo</a>, this leaves the current page alone and opens the page in the window/tab named “somename” (creating a new window/tab if it doesn’t exist) – If the Traversable navigable stack already exists, it adds the page to it: “history” will step back through the various pages that have been loaded into that “somename context”
The last two variations can be annotated: if the target is _blank (ie, always create a new window/tab), then use rel="opener"; if the target is a (possibly existing) named target (eg, target is somename), then use rel="noopener"
Relationships or Authority
In this arena, I’m referring to how this page indicates any relationship/authority to the document in the given link
External pages
You can use rel="external" to indicate that the document is not part of the current site – eg
Both URLs are absolute, so the only way to actually tell one is for an external document is the annotation
Pages we do not endorse
There are times when we link to a page, however we also want to indicate we don’t necessarily agree/endorse it’s content
Consider search page that both indexes internal documents, but also has a dataset of solutions harvested from external sources… and all results created dynamically, as internal pages: in this situation, we may want to indicate we do not necessarily trust/endorse the results we harvested (and imply we endorse/trust our own data).
rel="nofollow" is your friend here: nofollow indicates the original author/publisher does not endorse the referenced document
Referrers
As you browses the web, there is an optional HTTP “Referer” header – which sites can use for a number of reasons. By adding a rel="noreferrer" annotation, you can specifically request the client not to include the optional header (if it was going to)
Example
This creates three links to three different pages. Each one is to a external site, whose content we do not endorse, nor do we want our webpage added in the referer header (trying to reduce tracking.) We also indicate that the pages are all going to open in the same, but not our, “context”
Less obvious, but sometimes helpful annotations
There are a few additional annotations that can be used:
alternate: links to the current document in alternate version – eg, An Accessibility Statement may have a link to download a pdf copy of that statement
These three all apply to the current page – which may, or may not, apply to whatever service the web pages are describing. For example, the “terms of service” for a cloud mail provider are probably different to the “terms of service” to the web pages about that service.
license : The link is for the copyright licence for the current page
privacy-policy : The link is for the usage/privacy policy that applies to the current page
terms-of-service : The link is for the terms of service that apply to the current page
prev / next : These two imply the page is part of a series, and link to the pages either side
bookmark : This is related to prev / next, and give a permalink to the parent:
search : Search the current document and related pages. This is probably not the same as search the whole site – consider a document on health and safety policies on a corporate website:
is now semantically indicated to be limited to a subset of the whole site.
author : You may want to indicate who the page author is, amongst a list of names