Fragmentions - linking to any text
A couple of weeks ago, I went to a w3c workshop about annotations on the web. It was an interesting day, hearing from academics, implementers, archivists and publishers about the ways they want to annotate things on the web, in the world, and in libraries. The more I listened, the more I realised that this was what the web is about. Each page that links to another one is an annotation on it.
Tim Berners-Lee's invention of the URL was a brilliant generalisation that means we can refer to anything, anywhere. But it has had a few problems over time. The original "Cool URLs don't change" has given way to Tim's "eventually every URL ends up as a porn site".
Instead of using URLs, Google's huge success means that searching for text can be more robust than linking. If I want to point you to Tom Stoppard's quote from The Real Thing:
the search link is more resilient than linking to Mark Pilgrim's deleted post about it, which I linked to in 2011.
I don’t think writers are sacred, but words are. They deserve respect. If you get the right ones in the right order, you can nudge the world a little or make a poem which children will speak for you when you’re dead.
Another problem is that linking in HTML is defined to address pages as a whole, or fragments within them, but only if the fragments are marked up as an id on an element. I can link to a blog post within a page by using the link:
because the page contains markup:
<div class="post-body entry-content" id="post-body-90336631" >
But to do that I had to go and inspect the HTML and find the id, and make a link specially, by hand.
What if instead we combined these two ideas:
- use a fragment to identify part of a page
- mention words in the page as the identifier
I've named these "fragmentions"
To tell these apart from an id link,
I suggest using a double hash - ## for the fragment, and then words that identify the text. For example:
we can just escape spaces in the fragment using words that identify the text, as
id's cant have spaces in. For example:
means "go to that page and find the words 'annotate the web' and scroll to show them"
If you click the link, you'll see that it works. That's because when I mentioned this idea in the indiewebcamp IRC channel, Jonathan Neal wrote a script to implement this, and I added it to my blog and to kevinmarks.com. You can add it to your site too.
However, we can't get every site to add this script. So, Jonathan also made a Chrome Extension so that these links will work on any site if you're running Chrome. (They degrade safely to linking to the page on other browsers).
So, try it out. Contribute to the discussion on the Indiewebcamp Fragmentions page, or annotate this page by linking to it with a fragmention from your own blog or website.
Maybe we can persuade browser writers that fragmentions should be included everywhere.