Live data from Hacker News

Examples of Great URL Design (2023)

blog.jim-nielsen.com

41–50 of 163 posts

Re: Examples of Great URL Design (2023)

#41

Shout out to the classic "Cool URIs don't change": https://www.w3.org/Provider/Style/URI

... and the classic Penisland: https://www.penisland.net/

There was another classic from that era, powergenitalia.com, which purported to be the Italian division of Powergen, has now disappeared and apparently was a prank. Interestingly, some of the early captures of it seem to be another company, so maybe it was just an early attempt at SEO and they might have removed it due to the risk of being sued for trademark infringement: https://web.archive.org/web/20040830080331/http://powergenit...

Re: Examples of Great URL Design (2023)

#43
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://mpt.phrase...

I could have sworn there was a changeset in which Matt Mullenweg was implementing those cruft-free URLs in his new fork called Wordpress, but trying for google for something with "Wordpress" from the early 2000s is basically impossible in 2024.

Update: I found this: https://ma.tt/2004/08/mike-on-uris/

Re: Examples of Great URL Design (2023)

#44
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

Re: Examples of Great URL Design (2023)

#45
post #3

What’s the best way to handle url slugs that change? For example, if I have www.example.com/page/foo, and the user changes that page’s title to bar, the slug updates to www.example.com/page/bar and anyone visiting the old url gets automatically redirected to the new one. But now the old slug of foo can’t be used again (without appending some unique identifier to it, like foo-th683gh9i).

/page/:id/:slug-you-ignore, as in TFA. The id doesn't change, and the slug can be anything.

Rather than totally ignoring the slug, I prefer sending a 302 to the correct slug if the slug is absent or incorrect.

Re: Examples of Great URL Design (2023)

#48
These are my URL rules, in any project where I or my clients violate one of the rules - or their priority, we will regret it down the road.

URL-rules

URL-Rule 1: unique (1 URL == 1 resource, 1 resource == 1 URL)

URL-Rule 2: permanent (they do not change, no dependencies to anything)

URL-Rule 3: manageable (equals measurable, 1 logic per site section, no complicated exceptions, no exceptions)

URL-Rule 4: easily scalable logic

URL-Rule 5: short

URL-Rule 6: with a variation (partial) of the targeted phrase

URL-Rule 1 is more important than 1 to 6 combined,

URL-Rule 2 is more important than 2 to 6 combined,

URL-Rule 3 is more important than 3 to 6 combined,

URL-Rule 4 is more important than 4 to 6 combined.

URL-Rule 5 and 6 are a trade-off. 6 is the least important.

A truly search optimized URL must fulfill all URL-Rules.

My preferred URL structure is:

https://www.example.com/%short-namespace%/%unique-slug%

https:// – protocol

www – subdomain

example – brand

.com – general TLD or country TLD

%short-namespace% – one or two letters that identify the page type, no dependency to any site hierarchy

%unique-slug% – only use a-z, 0-9, and – in the slug, no double — and no – or – at the end. Only use “speaking slugs” if you have them under your total editorial control.

i.e.:

https://www.example.com/a/artikel-name

https://www.example.com/c/cool-list

https://www.example.com/p/12345 (does not fulfill the least important URL-Rule 6)

https://www.example.com/p/12345-product-name

Re: Examples of Great URL Design (2023)

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

Re: Examples of Great URL Design (2023)

#50
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

One example that springs to mind is the documentation site for WLED, an incredibly powerful microcontroller firmware for controlling addressable LEDs:

https://kno.wled.ge/

Post reply on HN