Live data from Hacker News

Examples of Great URL Design (2023)

blog.jim-nielsen.com

51–60 of 163 posts

Re: Examples of Great URL Design (2023)

#51
post #2

An example of a not-so-great URL design: Amazon product links have an optional slug before everything else like `{slug}/dp/{id}`. So you end up copying a gigantic URL everytime you wish to share a product unless you use the share product button to get the shortened link.

It’s not that difficult to shorten it to the minimal “/dp/:id”. I always take care to do that when sharing an Amazon link.

Re: Examples of Great URL Design (2023)

#52
post #49
post #29

I found Notion's URL schema interesting as well. They have to contend with renames of pages, reorganisation of the hierarchy and all that. So they have something like: notion.so/:account/Current-Name-of-Page-:pageid where the name changes if the page is renamed, but the redirect works, as the page ID is unchanged. In fact, one can just use notion.so/:account/:pageid and gets redirected to the right page, or even noti…

I don't understand why the :pageid needs to be prefixed with anything here.

So you can tell what the URL might point to by looking at it. That’s one of the important things mentioned in the article linked on this HN post: URLs are used by both computers and people.

Re: Examples of Great URL Design (2023)

#53
post #21

Earlier quoted context omitted.

I just delete everything after the product ID manually. There are probably easier methods.

The point is that the id comes last.

Which makes sense because URLs are often displayed such that only a prefix is visible. And for editing, it’s still easy to cut and paste the ID.

Re: Examples of Great URL Design (2023)

#54
post #49
post #29

I found Notion's URL schema interesting as well. They have to contend with renames of pages, reorganisation of the hierarchy and all that. So they have something like: notion.so/:account/Current-Name-of-Page-:pageid where the name changes if the page is renamed, but the redirect works, as the page ID is unchanged. In fact, one can just use notion.so/:account/:pageid and gets redirected to the right page, or even noti…

I don't understand why the :pageid needs to be prefixed with anything here.

its for humans I would expect, to know what the page refers to without opening it.

Kinda smart.

Also; taking it from the end means you only need to parse the string as an offset from the end. It can make load balancing much faster in theory.

Re: Examples of Great URL Design (2023)

#56
> 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):

> stackoverflow.com/questions/16245767/how-to-bake-a-cake

Fortunately for SO the fake slug is not preserved and redirects to the real one (so e.g. stackoverflow.com/questions/16245767/motheficker is not served from their site), much to the chagrin those of us with childish sense of humor who some 25 years ago enjoyed dynamically generated nonsense like:

https://web.archive.org/web/20031007123544/http://john.isgay...

Re: Examples of Great URL Design (2023)

#57
post #5

Earlier quoted context omitted.

The first example is just that. Put the id in the URL and make the slug optional. Stackoverflow makes the slug completely optional but you have the choice of only accepting foo and bar in your example

> https://stackoverflow.com/questions/78870603/i-LOVE-genocide This is bad.

This is not materially different from https://stackoverflow.com/questions/78870603#i-LOVE-genocide or https://stackoverflow.com/questions/78870603?i-LOVE-genocide.

Re: Examples of Great URL Design (2023)

#58

We take the typical blog url design (/2024/08/14/slug) for granted but back in the very early 2000s pretty much every blog tool had its own URL design. Matthew Thomas back then took an inventory: https://web.archive.org/web/20030810201315/http://mpt.phrase... He was on the search for his ultimate blogging system, where this "cruft-free" URL structure should be used: https://web.archive.org/web/20051107103030/http://m…

Well, arguably both Movable Type and Radio Userland's URLs were already pretty cruft-free. The success of Wordpress was mostly due to other factors (free, php, great feeds, great markup in default templates, great support for plugins).

Re: Examples of Great URL Design (2023)

#60
post #32

I forget where I ran across it, but one interesting adoption of URL design is to make the root of the directory part of the site's domain name. I.e. there was someone's website that was shared on HN, where their name was assembled with the domain name, TLD, and some characters after the first slash: firstna.me/lastname/ firstna.me/lastname/about

This arguably started with del.icio.us.
Post reply on HN