Removing numbers from internal Discourse link


(Ed Ball) #1

One of our users pasted a link to another topic into his post, but deleted the number(s) at the end. Clicking on the link updates the address bar in the browser, but that’s it. I would expect clicking on the link to try to jump to the topic, or if that’s not possible, to fail with an error message.

Example: 301 Moved Permanently


(Richard - DiscourseHosting.com) #2

I would expect any link that’s edited in an untoughtful way to fail desperately. Why do you expect something different?


(Jeff Atwood) #3

It works OK if you share the link elsewhere and it gets clicked on, or you paste the link into the address bar of the browser – and by OK I mean results in the expected 404 page.

Still, we should do a better job of handling this within the topic itself.


(sparr) #4

Why would you call this “unthoughtful”? Shortening links is a matter of good internet posting etiquette. Removing the comment number from the end is a very common action on many forums. Removing the longer number is dubious, and I recognize that it identifies the thread, but to some people the title of the thread would appear to be enough identification to leave. I do question why they wouldn’t test the link before editing, but if it works outside the site and not inside (which it may or may not, in different cases) then something is wrong.

http://meta.discourse.org/t/removing-numbers-from-internal-discourse-link/6251/3
http://meta.discourse.org/t/removing-numbers-from-internal-discourse-link/6251
http://meta.discourse.org/t/removing-numbers-from-internal-discourse-link


(Sam Saffron) #5

Personally, this is why I prefer the scheme used in SE over the one we use.

SE uses: http://stackoverflow.com/questions/16309690/some-slug

We use : http://meta.discourse.org/t/removing-numbers-from-internal-discourse-link/6251/4

The slug is “throwaway info” I think it should be in the end of the url.


(Jeff Atwood) #6

The counter-argument is that you read from left to right, in English and most other languages.

So you want the most important bit at the left. What’s more important?

  1. The human readable slug?
  2. The computer readable number?

I think clearly #1 is more important, I don’t care about computers. So the part humans can process should be first.

However the downside is that if the link gets truncated, you can lose the topic ID which breaks the link. Personally in an era of pervasive link shorteners and modern email clients, I don’t see links getting truncated all that much these days… it was a problem back in 2005 though.


(Stefan Bucur) #7

These shortened links seem now to perform in an inconsistent manner. If I go to 301 Moved Permanently, I get 404. However, if I now refresh the window, the missing ID is filled in automatically and the post loads successfully. If the human-readable slug uniquely identifies the topic, it would be nice to get this redirection from the start.


(Tobias Eigen) #8

That is puzzling… why does that work?

Generally speaking I have often wished for admin options to allow me to make my links shorter that nobody I s tempted to fuss with. EG using an alternate short domain name and no human readable title and no username at end.

Eg. This fictional url http://kb2.org/t/-/123

Cheers


(Jeff Atwood) #9

I think there are new bugs around the slug only URLs. I was noticing that problem too. @neil can you have a quick look?


(Neil Lalonde) #10

Looks like @eviltrout fixed this two days ago:

https://github.com/discourse/discourse/commit/c16b8364ab0edd83f19a9930e1fe9612a9f49875


(Jeff Atwood) #11