top | item 41244962

(no title)

imrehg | 1 year ago

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

    notion.so/:account/Anything-else-:pageid
works too...

This is very handy in my use cases, when various Notion data is extracted into another tool, reassembled, and then needed to have a link to the original page. I don't need to worry about the page's name, or how that name gets converted into the URL, or any race conditions....

The page hierarchy is then just within the navigaton, not in the URL, so moved pages continue to work too (even if this looks like a flatter hierarchy than it really is).

I'm sure there are plenty of drawbacks, but I've found it an interesting, pragmatic solution.

discuss

order

didntcheck|1 year ago

I've noticed that Confluence, Reddit, and a good number of news sites do the same thing. Usually the title segment is entirely ignored, meaning you can prank someone by changing the title part to something shocking, and it just redirects to the usual page, because the server only cared about the ID bit

The fact that so many sites do this (including "normie" news sites) shows that site designers clearly believe users want and expect "informational"/"denormalized" URLs, rather than /?id=123

simonw|1 year ago

It’s an SEO thing.

The better way to implement this is to serve a 301 redirect if the words in the URL don't match the expected ones, that avoids trickery and also removes the risk of the same page being accidentally indexed as duplicate content.

KMnO4|1 year ago

There is (was?) also a terrible flaw with this, in that any site hosted on Notion (even using its own domain) would show you public pages with a valid page id.

So, if Paul Graham hosted his site via Notion (he doesn't), I could link someone to `https://paulgraham.com/Why-I-Hate-Hackernews-be2839f0-e145-4...` and it would show my (fake) page on PG's domain.

dgb23|1 year ago

I don't understand why the :pageid needs to be prefixed with anything here.

bathtub365|1 year ago

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.

dijit|1 year ago

its for humans I would expect, to know what the page refers to without opening it.

Kinda smart.

Also; taking it from the end means you only need to parse the string as an offset from the end. It can make load balancing much faster in theory.

toasterlovin|1 year ago

It’s for SEO. Perhaps it’s a historical concern and no longer relevant, but the URL is/was used by Google to understand what the page is about.

aqfamnzc|1 year ago

I believe amazon does something similar for product pages. The `/dp/` is the product id that really matters.

Kiro|1 year ago

Why end with the id instead of doing it like SO, as per the example in the article?