Live data from Hacker News

Choosing between names and identifiers in URLs

cloudplatform.googleblog.com

41–50 of 157 posts

Re: Choosing between names and identifiers in URLs

#41

"The downside of the second example URL is that if a book or shelf changes its name, references to it based on hierarchical names like this one in the example URL will break." The author appears to have forgotten about 3xx redirection codes which were intended to solve that very problem.

But have been abused for black SEO and now are considered suspicious by search engines so we use them sparingly. This is why we can't have nice things.

I don't buy it.

Redirecting to canonical URLs is canonicalization 101. https://support.google.com/webmasters/answer/139066?hl=en#4

Also, what would be an example of same-origin redirect abuse?

Re: Choosing between names and identifiers in URLs

#42
post #6

For Canny, I wrote some awesome code that I'm proud of that turns a "post title" into a unique URL. https://react-native.canny.io/feature-requests/p/headless-js... For example, a post with title "post title" will get url "post-title". Then a second post with title "post title" will get url "post-title-1". Since there's only one URL part associated with each post, it's a unique identifier. This gets rid of the ugly id…

The annoying part is doing the database lookups to check for collisions / canonicalization, so what would your lib be generalizing?

Re: Choosing between names and identifiers in URLs

#43

Earlier quoted context omitted.

This seems like it's vulnerable to some form of abuse. library.com/books/1as03jf08e/Moby-Dick/ library.com/books/1as03jf08e/Hitchhikers-Guide-to-the-Galaxy Now lead to the same place...

You would redirect to the canonical one.

You don't necessarily have to redirect, but you should at least include `` (as given example StackOverflow does) so that search robots and other website (scrape and/or API) clients know which one is the canonical path, to avoid duplicate efforts.

Re: Choosing between names and identifiers in URLs

#44

Earlier quoted context omitted.

This seems like it's vulnerable to some form of abuse. library.com/books/1as03jf08e/Moby-Dick/ library.com/books/1as03jf08e/Hitchhikers-Guide-to-the-Galaxy Now lead to the same place...

You would redirect to the canonical one.

I think the concern is in the way it obscures the target. Replace "Moby Dick" with a Chuck Tingle (warning, probably nsfw) book. Now that second link is a serious problem.

Re: Choosing between names and identifiers in URLs

#45

Earlier quoted context omitted.

You would redirect to the canonical one.

You don't necessarily have to redirect, but you should at least include ` ` (as given example StackOverflow does) so that search robots and other website (scrape and/or API) clients know which one is the canonical path, to avoid duplicate efforts.

That only works for some crawlers. Certainly not for users. Meanwhile, everything obeys redirects.

Since you bring up Stack Overflow, notice that they do the canonical redirect. Change the title in the URL and you'll get redirected.

Re: Choosing between names and identifiers in URLs

#46
post #4

Good advice. Interesting that Canonical URLs aren't mentioned. But the sheer arrogance of serving a webpage that doesn't render any text unless you execute their JavaScript really annoys me. It's not a fancy interactive web-app, it's a webpage with some text on it.

I understand the frustration but you also understand that the vast majority of individuals render JS on the page and do not use text only browsers. It’s not worth the time to appeal to such a minority share of internet users.

Your argument holds for web apps where it might be extra work to do progressive enhancement. But this is literally a webpage of text. It is more work to get JS involved.

Humans using off the shelf browsers aren't the only ones who consume webpages.

Re: Choosing between names and identifiers in URLs

#47
post #44

Earlier quoted context omitted.

You would redirect to the canonical one.

I think the concern is in the way it obscures the target. Replace "Moby Dick" with a Chuck Tingle (warning, probably nsfw) book. Now that second link is a serious problem.

I see what you're saying, but it doesn't seem like much more than a funny gag you might pull on a friend.

If a website is concerned about that case, then instead of letting it inform their URL design, they should have a "Warning: Adult content. [Continue] [Back]" interstitial like Reddit or Steam.

Re: Choosing between names and identifiers in URLs

#48

Earlier quoted context omitted.

But have been abused for black SEO and now are considered suspicious by search engines so we use them sparingly. This is why we can't have nice things.

I don't buy it. Redirecting to canonical URLs is canonicalization 101. https://support.google.com/webmasters/answer/139066?hl=en#4 Also, what would be an example of same-origin redirect abuse?

Bypassing black lists when posting links while still benefiting from crawlers following the links comes to mind.

During the 2000s, following links for a forum or blog was way too expensive, so they had black lists of dirty words to avoid porn sites spaming and get juice during the page rank golden years where any back reference mattered.

Hence it was just easier, to avoid the filters, to create non blacklisted domain names with redirections.

Then another trick was to write a perfectly legitimate page, get google to index it, then redirect that page to the less legitimate page. Because at the time Google refreshed once a week (or a month...), you'd get plenty of traffic and revenue for long enough to be worth it. If you sold niche porn and viagra, that is.

Another one was just to setup fake sites with different URL schemes with stats on them, and get a regular update on which URL formats were getting the best hits. At the time URLs where very important in getting points. Then you would regularly update your most important sites URL scheme accordingly, several times a year if needed.

Re: Choosing between names and identifiers in URLs

#49
post #34

The article talks about referring to resources by using URLs containing opaque ID numbers versus URLs containing human-readable hierarchical paths and names. They give examples like bank accounts and library books. This problem about naming URLs is also present in file system design. File names can be short, meaningful, context-sensitive, and human-friendly; or they can be long, unique, and permanent. For example, a…

A long time ago, around when I was first taking systems programming courses, I had this vision for a filesystem and file explorer that would do exactly what you say. I imagined an entire OS without any filepaths for user data (in the traditional, hierarchical sense). My opinion (both now and back then) was that tree structures as a personal data filing system almost always made more of a mess than it actually solved. Especially for non-techies.

Rather, everything would automatically be ingested, collated, categorized, and (of course) searchable by a wide range of metadata. Much of it would be automatic, but it would also support hand-tagging files with custom metadata, like project or event names, and custom "categorizers" for more specialized file types.

Depending on the types of files, you could imagine rich views on top -- like photos getting their own part of the system with time-series exploration tools, geolocation, and person-tagging with face recognition, or audio files being automatically surfaced in a media library, with heuristics used to classify by artist, genre, etc. But these views would be fundamentally separate from the underlying data, and any mutations would be stored as new versions on top of underlying, immutable files, making it easy to move things between views or upgrade the higher level software that depended on views.

This was years ago, and I never got around to doing any of that (it would've been a massive project that likely would've fallen flat on its face). And now, in a roundabout kind of way, we've ended up with cloud-based systems that accomplish a lot of what I had imagined. I'd go so far as to say that local filesystems are quickly becoming obsolete for the average computer-user, especially those who are primarily on phones and tablets. It's a lot more distributed across 3rd party services than what I had in mind, but that at least makes it "safer" from being lost all at once (despite numerous privacy concerns).

Re: Choosing between names and identifiers in URLs

#50
post #44

Earlier quoted context omitted.

You would redirect to the canonical one.

I think the concern is in the way it obscures the target. Replace "Moby Dick" with a Chuck Tingle (warning, probably nsfw) book. Now that second link is a serious problem.

I'm not even sure it's a serious problem - a possible annoyance, and perhaps, for a spammy site owner, maybe even a feature. But as a web user, I'm not really fond of that added uncertainty.
Post reply on HN