Live data from Hacker News

Examples of Great URL Design (2023)

blog.jim-nielsen.com

71–80 of 163 posts

Re: Examples of Great URL Design (2023)

#71
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.

I think this is actually a really great design in that the name of the product can always be in the URL. The "slug" is completely ignored and just there for SEO/humans. If you send a link I instantly know what it's for -- that's pretty useful! I also like that the "id" which is an ASIN (Amazon Standard Identification Number) which is a superset of all ISBNs. This means you can just enter any book ISBN directly into t…

While the slug helps someone know what they're opening before reading it, most apps have link previews which give you just enough information you need.

Re: Examples of Great URL Design (2023)

#72
Back when I was working on GOV.UK Verify we had URLs that looked something like /verify-passport for English and /cy/verify-passport for Welsh. I made the decision that if readable URLs was a design goal they should be readable in both languages, and ended up localising them all to (for example) /verify-passport and /gwirio-pasbort. No idea if anyone ever noticed, but sometimes it’s nice to sweat the small stuff.

Re: Examples of Great URL Design (2023)

#73
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.

Lol this is almost the exact same thing as the very first example of good URI design in the article

If you're referring to the StackOverflow example from the article, it's different because they follow `/questions/:id/:slug`. Keeping slug at the end makes it a lot easier to delete while keeping it readable.

Re: Examples of Great URL Design (2023)

#75
I gotta say, Datadog does this pretty well. They manage all their state (just information state, not like user sessions lol) in the URL, which makes it easy to integrate with and dynamically generate links and share information, and manages to stay human readable.

Re: Examples of Great URL Design (2023)

#76
post #62

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…

He calls file extensions cruft, but i've come to value them. They are a simple way to indicate file type - desired or offered - which is easily understood by machines and people. I currently work with an API which does a bit of content negotiation using the Accept header, so clients can request data in various formats - application/json for a snapshot, text/event-stream for an updating feed, or text/html for an inter…

For _APIs_ I prefer to use both - the only downside is that resource names need to be restricted to _not_ include trailing `.{EXT}`s (either at all or limiting EXT to things that aren't valid content types).

E. g. `/books` - looks at the `Accept` header. `/books.json` - sets the `Accept` header to `application/json`. `/books.xml` - `application/xml`, and so on.

Re: Examples of Great URL Design (2023)

#78
The Slack URL scheme, and a few others mentioned in other comments take me right back to hp.com/go/, so hp.com/go/proliant would take you to Proliant servers, maybe.

The idea was really cool, but from talking to people at HP at the time, the implementation was apparently a complete nightmare done with an insane number of rewrites. It was sort of a hit and miss if the thing you typed in after /go/ would actually take you to the correct location, if any.

Re: Examples of Great URL Design (2023)

#79

I can't check this because I'm on mobile, but I presume Stack Overflow uses a canonical tag in the HTML to state their preference that the longer version with the slug should be the default, because that's the one search engines use.

Stack Overflow returns with a 301 and a location header containing the slug.

https://stackoverflow.com/questions/16245767

Responds with a 301 and a location header value of `/questions/16245767/creating-a-blob-from-a-base64-string-in-javascript`

Re: Examples of Great URL Design (2023)

#80
post #15
post #10

One big question in URL design is this: Do path parameters get to have / in their values? Let’s say you have a link shortener service and want to allow users to define shortcuts like /mypath/:rest where rest is appended to example.com/ Now you’re in a very interesting position when it comes to resolving URLs. Curious to hear folks with experience in this

As per RFC 3986 [1], reserved characters such as , and / must be URL encoded. , is encoded as %2C / is encoded as %2F [1] https://www.rfc-editor.org/rfc/rfc3986

That's not the question. The question is what if you have an open ended URL param that can also have subpaths?
Post reply on HN