I recently launched the Open Source Protocol (OS Protocol), a standard that can be used to link to where the code for a website is hosted. The protocol is fairly simple—all it involves is metatags, and most websites will only need two or three lines of code to be compliant.
OS Protocol is based on Facebook's Open Graph Protocol (OGP) and Twitter's Card protocol. Both of these use metatags in an HTML document's header to help their crawlers get metadata about a website; the site name, picture, a description. What I envision is a different sort of crawler that can identify the source of a page.
Getting to the source
Why would someone need to identify a page's source? Currently, if I am on a website and I see a bug, see something interesting that I'd like to see the code for (like a cool javascript transition, or CSS pattern), or am interested in contributing to the website, there is no way for me to know programmatically where the site is hosted. I can look for an About page and eventually find a 'Contribute' doc, or I could Google the company or site name and see if I can find the source somewhere, but for the most part these searches are time-intensive and not rewarding.
Sometimes it's easy to find the source for a site. A good example would be sites hosted by GitHub Pages, where the URL is often a subdomain of GitHub or there's a banner saying "Fork this site." This is a major step forward—I can see the source code and clone or patch it with just a couple clicks. What I envision is this sort of functionality on every site. To that end, I sat down and thought about the best way to display where a site is hosted for possible users.
The obvious solution
Metatags are an obvious solution, both in terms of size for the user and developing effort needed to maintain. Here's an example of a fully compliant list of metatags:
<link rel="profile" href="http://osprotocol.com">
<meta property="os:repo" content="https://github.com/RichardLitt/open-source-protocol">
<meta property="os:rcs_type" content="git">
<meta property="os:src" content="git@github.com:RichardLitt/open-source-protocol.git">
Ideally developers would start adding this to their own sites and an ecosystem could form around them encouraging use. Such an ecosystem would be like OGP or Twitter Cards; an example would be a Chrome extension or Firefox add-on that would notify the user with a floating button to the source code if OSP is detected on a site. Another example would be a plugin for Wordpress to help users automatically add OS Protocol metatags to their blog if the code for the site is openly stored. For most sites, adding the code shouldn't take much time at all; just add it to the header of the document.
Why it matters
It used to be that someone could see all of the source code for a site just by inspecting it in the browser, but this is no longer the case. CSS is far too complicated on most sites, and has sometimes been put through minifiers or compiled from SASS or Less. The same goes for Javascript, which is often served up in a minified, compressed, or even browserified format. Looking at the source code is necessary to have any idea what is going on.
My hope is that something like the OS Protocol will help future developers. It would have to be adopted widely, which is an ambitious goal. Protocols are a dime a dozen, and instituting one creates a catch-22; there has to be some immediate use for adding the code to be worthwhile, but there won't be a use without a large amount of conforming sites. However, discussion on the topic itself is a step in the right direction. To join in that discussion, go to osprotocol.com, inspect source, and check out the GitHub repo where it's hosted (the link is in the metatags, of course).
1 Comment