Aral and his trusty sidekick Victor have taken up residency for a while at the Clearleft office in Middle Street while they work on their very exciting project. It’s nice having them around.
I got chatting to Aral about a markup pattern that’s become fairly prevalent since the rise of Github: linking to the source code for a website or project. You know, like when you see “fork me on Github” links.
We were talking about how it would be nice to have some machine-readable way of explicitly marking up those kind of links, whether they’re in the head
of the document, or visible in the body
. Sounds like a job for the rel
attribute, I thought.
The rel
attribute describes the relationship of the current document to the linked document. You can use it on the link
element (in the head
of your document) and the a
element (in the body
). The example that everyone is familiar with is rel=”stylesheet”
when link
ing off to a CSS file—the linked document has the relationship of being a stylesheet for the current document.
The rel
attribute could theoretically take a space-separated list of any values, just like the class
attribute. In practice, there’s much more value in having everyone agree on which rel
values should be used.
There used to be a page on the WHATWG site for listing rel
values, but it tended to stagnate. So now the official registry for rel
values is on the microformats wiki. That’s where you can see which values are recommended for use today and you can also brainstorm new ideas.
The benefit of having one centralised for this is that you can see if someone else has had the same idea as you. Then you can come to agreement on which value to use, so that everyone’s using the same vocabulary instead of just making stuff up.
It doesn’t look like there’s an existing value for the use case of linking to a document’s (or a project’s) source code so I’ve proposed rel=”source”
.
Now I should document some use cases of people linking their site to its source code. It might be that wikis qualify as another use case: every “edit” button points to the source of the document in wiki markup.
If you have any thoughts on this pattern, or examples to add, please feel free to add them.