URL slugs: where should the topic ID number go?


(Waleed Khan) #1

I notice on Stack Overflow, URLs are like http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags; that is, the ID comes before the human-readable section. But on Discourse, it’s in the form http://try.discourse.org/t/this-is-my-topic-title/686. Considering that the former form would probably help with all those anti-ascii characters making unviewable topics, why is the current form being used? Is it better for SEO or something?


(Brandon Rampersad) #2

The stackoverflow one is better in terms of readability. Users are more likely to read the end of an url than the beginning.


(Ben Doerr) #3

I’ve asked my mom and my wife. They don’t read urls. :wink:


(Waleed Khan) #4

I suppose they also don’t visit forums or programming Q&A sites either, so I’m not sure that really says anything.


(Chris Thorn) #5

I doubt it’s the reason, but a nice side effect is that it’s much easier for a human to scan the URL and pull out the post and reply ids from

http://meta.discourse.org/t/discourse-org-post-id-slug-vs-discourse-org-slug-post-id/1840/4

as opposed to

http://meta.discourse.org/t/1840/discourse-org-post-id-slug-vs-discourse-org-slug-post-id/4

I could see it helping out during development.


(Ben Doerr) #6

I should have quoted.

I know many non-technical forum users, I doubt any of them would think twice about that “URL thing” except to copy and paste it into an email, or “Is it http or https”. However thats just anecdotal.


(Waleed Khan) #7

[quote=“thorncp, post:5, topic:1840”]it’s much easier for a human to scan the URL and pull out the post and reply ids from

http://meta.discourse.org/t/discourse-org-post-id-slug-vs-discourse-org-slug-post-id/1840/4

as opposed to

http://meta.discourse.org/t/1840/discourse-org-post-id-slug-vs-discourse-org-slug-post-id/4

I really don’t see a significant difference. Although, on my phone, I find having the pertinent part of the URL nearest to the end to be slightly better.


#8

The difference I see between the two is that one is essential and one isn’t. The slug is just a way to make URLs more readable, and should therefore be at the end, where it can safely be trimmed off. This is how most sites do it, from reddit to StackOverflow.


(Brad Westness) #9

Wouldn’t that solve the illegal-characters-in-thread-titles issues as well, since the slug could effectively be ignored by the routing mechanism?


#10

Right. The slug ends up being just a cosmetic addition.


(Jeff Atwood) #11

I think it’s not a huge deal either way, but I do believe that

http://meta.discourse.org/t/discourse-org-post-id-slug-vs-discourse-org-slug-post-id/1840/4

is slightly preferable to

http://meta.discourse.org/t/1840/discourse-org-post-id-slug-vs-discourse-org-slug-post-id/4

because it puts the title first, and I get to the title sooner, before being interrupted by relatively meaningless numbers.

You know, the whole “Don’t Bury the Lede” thing. But it’s a small difference.