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.
Examples of Great URL Design (2023)
61–70 of 163 posts
Re: Examples of Great URL Design (2023)
#62We 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…
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 interactive dashboard. I wish it didn't. I wish we'd just used file extensions. Trivial to use in a browser or via curl, trivial to implement on either side.
Re: Examples of Great URL Design (2023)
#63I 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.
Re: Examples of Great URL Design (2023)
#64Using a numeric ID + ignored path part is easy to implement, but actually using the textual part without an exposed ID seems more elegant to me. Tip for implementing that: * have a separate table that maps slugs to IDs, allowing many-to-one relationship, because content's title will be updated, and you don't want to break old links. * long slugs will get truncated by users. A zero-cost way to recover from that is `se…
the problem with that, as mentioned in the article, is that that breaks if the content of the page changes. So on stack overflow for example, what happens if someone changes the title of their question? you either break the url or use an old version of the title, thus being misleading.
Re: Examples of Great URL Design (2023)
#65One 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
This can be a complex topic if you don’t set clear constraints on what constitutes a valid character in your URL or domain. For instance, in query parameters, spaces are encoded as '+'. But what if '+' is also a valid character in your domain? You then need to disambiguate i.e between "name?foo+bar" meaning "foo bar" or "foo+bar". Which one is the user actually referring to? In our case, we ended up needing users to…
Re: Examples of Great URL Design (2023)
#66Re: Examples of Great URL Design (2023)
#67I 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
Re: Examples of Great URL Design (2023)
#68Understanding the URL structure of any site can also help you see things that are not accessible through the UI.
Re: Examples of Great URL Design (2023)
#69Shout out to the classic "Cool URIs don't change": https://www.w3.org/Provider/Style/URI
... and the classic Penisland: https://www.penisland.net/
Re: Examples of Great URL Design (2023)
#70I might be an outlier, but I don't like slugs in URLs. They make URLs unnecessarily long, often forcing people to use URL shorteners -- completely defeating the purpose. They get awkward when the author changes the title. Other commenters mentioned some tricks to get around this issue, but all involve redirects. Cools URLs shouldn't change in the first place. They don't copy cleanly if you use nonalphanumeric charact…