Page:Aaron Swartz s A Programmable Web An Unfinished Work.pdf/26

From Wikisource
Jump to navigation Jump to search
This page has been proofread, but needs to be validated.

14 2. BUILDING FOR USERS: DESIGNING URLS

or even:

    http://www.hulu.com/watch/17003/this-is-where-i-got-thejoke-above [1]

and still get the right page. This isn’t perfect, since many users will still think they have to type in the long text “saturday-night-live-weekend-update-judy-grimes,” but it’s probably outweighed by the number of additional users who will find you more easily on search engines. (Ideally, there would be some way in the URL to indicate to humans that the remaining text is optional, but I haven’t seen any conventions here yet. I guess the hope is that they’ll notice the number and just get the idea.)

(You’ll note that all these URLs are within directories, not at the top-level. This just feels cleaner to me—I don’t like imagining the entire site’s files are sprawled across the root directory randomly; it’s much nicer to think of them stacked up inside ‘/watch/‘ or ‘/b/‘. But if your main nouns are subdirectories themselves, as with the user pages on Twitter and Delicious, it might make sense to break this rule. (More on this in a bit.))

Numbers work well in cases where pages get created automatically (maybe you’re importing a lot of stuff, or you generate pages in response to emails or incidentally for other actions) or their titles tend to change, but in other cases you might prefer what’s called a slug. A slug is just a little bit of text that looks good in a URL, like “wrt/dfw” or “beyond-flash”. When a user creates a page, you have them create the slug at the same time (perhaps including an auto-generated one from the title by default), and then you force them to stick with it (or else make sure to redirect all the old ones whenever it changes).

On sites like Wikipedia, slugs are basically generated incidentally. When you include text like “Jackson was hardly a fan of the late Robert Davidson‘ the site automatically links you to a new page with the slug “Robert/Davidson”. Especially with the numerous conventions about titles Wikipedia has built over the years (along with the endless back-up redirects), the result is surprisingly convenient.

You’ll note that all this discussion has basically been about nouns—the main things that make up your site, whatever those are (videos, blog posts, books). There

  1. Isn’t interesting how even though we typically read books as series of pieces of paper stacked from left to right, we still refer to things that come earlier as “above” the others (or supra if you want to be all Latin about it), as if we were all reading the raw scroll of paper that Kerouac emitted from his typewriter. See, e.g., http://www.npr.org/templates/story/story.php?storyId=11709924 for details. Of course, unlike my typewriter or notebook-bound predecessors, I’m writing this in a wordprocessor whose simulated form of up-down perfectly mimics Kerouac’s physical scroll. Coming full circle, I suppose.