Here’s Kyle Aster on why thoughtful URL design is important (in 2010):
URLs are universal. They work in Firefox, Chrome, Safari, Internet Explorer, cURL, wget, your iPhone, Android and even written down on sticky notes. They are the one universal syntax of the web. Don’t take that for granted.
I love this reminder of the ubiquity of URLs. They’re not just for typing into browser bars. They’re used in a plethora of ways:
- As targets for scripting and scraping and other programmatic data retrieval.
- As references, printed in the footnotes and appendixes of physical books.
- As actionable triggers accessible via physical mediums, e.g. scannable QR codes or IoT device buttons.
- And more!
When I reflect on examples of great URL design I’ve encountered through the years — URLs that, when I saw them, I paused and thought “Wow, that’s really neat!” — these are a few that come to mind.
StackOverflow was the first place I remember encountering URLs that struck a nice balance between the needs of computers and humans.
The URLs follow a pattern like this:
:id is a unique identifier for the question that reveals nothing about the content.
:slug, on the other hand, is a human-readable paraphrasing of the question that allows you to understand the question without ever actually going to the website.
The beauty is
:slug is an optional parameter in the URL. For example:
Tells you nothing about the question being asked but it’s a valid URL that allows a server to easily find and serve that unique piece of content.
But StackOverflow also supports the
:slug part of the URL which allows humans to quickly understand the contents living at that URL.
As noted, the
:slug is optional. It is not required by the server to find and serve the contents in question. In fact, it can easily be changed over time without without breaking the URL (which I find quite elegant).
Granted, it can also be used deceptively. For example, this is the same URL as above but it portends completely different contents (without breaking the link):
But hey, trade-offs in everything.
I remember when Slack launched a marketing campaign to educate people about the product. They used the language of the marketing campaign – “Slack is...” — in the page copy as well as in the URLs, e.g.
I remember being so intrigued at this effort to bring the design of the story-telling campaign all the way up into the URLs themselves.
Since then, I’ve always found delight in URLs that try to form natural languages sentences —
slack.com/is/team-communication — rather than concatenate a series of hierarchical keywords —
Speaking of doing fun things with sentence structure in your URLs...
Jessica Hische has her website under a
.is domain (which is for Iceland, apparently).
She riffs on this fun third-person form of “I am” across her site. For example, click on “About” in the primary navigation and it takes you to:
mydomain.com/about is clear too, but I love the whimsy of describing the “about” and doing it in sentence structure.
All of the nouns in her primary navigation follow this pattern, as well as her individual pieces of work. Like this writeup about one of her holiday culinary packaging gigs has the URL:
URLs as Product
I’ve always loved services whose URLs map nicely to their domain semantics. For example, GitHub’s URLs map really well to git semantics like the three dot diff comparison in git:
For technical products, this ability to navigate a website without necessarily seeing the user interface is a cool superpower.
NPM is somewhat similar. Want to see
react-router on NPM? You don’t have to go to NPM’s home page and click around or use their search box. Once you become familiar with their site structure, you know you can lookup a package using:
Want to lookup a specific version of a package?
These kinds of shortcuts are super useful when you’re using a particular product. In the case of NPM, you’re hunting through your
package.json and need to lookup some details of a specific package pinned at a specific version, you can navigate to NPM’s details of that package by merely identifying the version you want and typing the details into a URL bar.
NPM CDNs like unpkg do a good job at following these semantics as well. Want a file from a published package? The homepage of unpkg says:
In cases like this, the URL can be the product itself which makes its design all the more vital.
These are a few examples of URLs I’ve enjoyed using or seeing over the years. I’m sure there are others, but I’d be curious to know what your favorites are? Blog ’em!
- I haven’t found a lot of great resources on “great URL design”. This article by Alex was pretty good. I almost wish there was a “Dribble” for URL design. Just people showing off great URLs. For anyone with the ambition,
url-gallery.comis available… ↩
- Michael Jackson, creator of unpkg, pointed out: “It amazes me that unpkg has become as popular as it is considering that every URL anyone has ever used with it was crafted by hand. There is no search box.” That is amazing indeed! unpkg is very popular: 50 billion requests in a month in Sept-Oct of 2020. ↩