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

14  '''2. BUILDING FOR USERS: DESIGNING URLS''' or even:

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

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 ﬁnd 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 ﬁles 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-ﬂash”. 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