![]() |
|
![]() |
| .htm and .html is relevant just like .pdf and .zip etc etc
But I agree about .php, .aspx and other extensions that are telling something about the server side. That’s irrelevant for the user. |
![]() |
| > .htm and .html is relevant just like .pdf and .zip etc etc
it's _kind of_ relevant, if it weren't for the fact that the absence of any extension implies .html >99% of the time |
![]() |
| 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. |
![]() |
| "Q: Can I provide my own wood? A: In most cases we can handle your wood. We do require all shipments to be clean, free of parasites and pass all standard customs inspections." |
![]() |
| I agree that is a cool feature. I would say it's from its Rails background where such a thing is encouraged (.json or .html (or no extension)) on a resource give you two different outputs |
![]() |
| 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. |
![]() |
| At least that stuff is actually informative to a human. A lot of Amazon's URL bloat is the analytics crap they shove into query string. I started using ClearURLs specifically because of Amazon. |
![]() |
| having, like you, studied amazon urls, I just automatically delete everything?inclusive after the "?", then I edit the slug to make it contain a message personalized for my recipient |
![]() |
| Note, if you are using optional slugs or otherwise, you should have a canonical url in the header so that search results will be collated to a single canonical url. |
![]() |
| Post author here. There are so many great additional examples of intriguing URL patterns in the comments here. TY everyone for sharing ones you remember! |
![]() |
| 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) |
![]() |
| Similar to the Slack example given in the post with /is/ URLs, KDE has /for/ URLs with pages which present the KDE project and software for various user profiles: developers, kids, scientists, students, creators, gamers, activists, etc.
See all these pages here: https://kde.org/for/ |
![]() |
| Another interesting related area is designing URLs for third-party components.
Third-party component have to coexist with existing site navigation logic, so generally you can't safely add URL-based configuration to such a component. Fortunately, configuration can now be stored in fragment directives in order to hide this from normal site routing. e.g.
With fragment directives, location.href and location.hash exclude the additional content in the hash after :~:This is used in Transcend Consent Management for configuring parameters to debug and simulate various privacy experiences[1]. 1. https://docs.transcend.io/docs/consent-management/reference/... |
![]() |
| 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 |
![]() |
| What is the actual harm in allowing people to put random text at the end of the url?
Not to mention something similar can be done to any url, e.g. #whatever-you-want or ?_=whatever-you-want |
![]() |
| I don't think will be relevant going forward, Safari already hides the URL beyond the domain name by default, and I presume other browsers do/will too. |
![]() |
| As the article mentions, URLs are used in more contexts than being displayed in the address bar, so the content remains relevant regardless of Safari's poor aesthetic decisions. |
![]() |
| Actually, not encoded slashes in the paths are not that unheard of as one might think. As an example, this is actual Wikipedia article about... the meaning of "two slashes": https://en.wikipedia.org/wiki/// . Also, encountering buggy concatenations like example.com//some-path or example.com/base//some-path is quite common.
Don't ask how I know. |
![]() |
| I never thought of this! I have an 'a' in my first name but just checked, 'rest of my first name + last name'.com is already taken. Oh well, I already have 'my initials'.dev, it'll have to do. |
![]() |
| Everything should be accessible via the identity of its composition (a hash or equivalent). Then all the data needed to render it be computed or downloaded from some peered cache (DHT). |
![]() |
| So when you bookmark the Hacker News frontpage, that would be a hash of its current content and then you will visit that stale stale version forever and never see any new stories? |
![]() |
| It was cool to see Jessica Hische called out. We own a couple of her children's books. Always fun when my parenting and tech worlds collide in surprising ways. |
![]() |
| I always liked that you can prepend reddit.com/ or redd.it/ to any URL (http and all) and get taken to a prefilled submit page for it. |
![]() |
| Just remember to build localization into your URLs.
mysite.com/en-us/some-page mysite.com/en-ca/some-page You can 301 redirect some locale to your "base" URL if you want. mysite.com/en-us/some-page > mysite.com/some-page But don't stress too much. Google doesn't really care about URL content any more. People on phones don't care what your URL says. It's at most desktop users, and devs. Don't stress localizing your URLs... mysite.com/fr-ca/some-page is just as good as mysite.com/fr-ca/une-page... and the former is a lot easier to tie into email marketing variables. Just keep your sitemaps in the localized folder. mysite.com/sitemap.xml... just a link to the various localized sitemaps. mysite.com/en-us/sitemap.xml etc. By keeping sitemaps in a localized folder, it'll make it a lot easier for yourself as you go to register your site with each market's locale. If you just have to localize URLs... consider doing what Amazon does and just tie the URL to an ID. https://www.amazon.com/Moen-One-Handle-Bathroom-Deckplate-84... the above is the same as this... https://www.amazon.com/dp/B0CFYPTKF8 And you can put anything you want in the URL string, it just matches on the ID. https://www.amazon.com/literally-whatever-you-want-here/dp/B... “We use the words in a URL as a very very lightweight factor. And from what I recall this is primarily something that we would take into account when we haven’t had access to the content yet… [but] as soon as we’ve crawled and indexed the content there then we have a lot more information. And then that’s something where essentially if the URL is in German or in Japanese or in English it’s pretty much the same thing.” - John Mueller, Google Search Advocate. |
![]() |
| > 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... |
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.