What is the number in the topic URL?


(Scott Trager) #1

Hi guys,

When you go to a topic (for example JSON codes doesn't always execute) it appends a number to the end of the topic.

When I navigate to that page through a link (for example /meta.discourse.org/t/json-codes-doesnt-always-execute/) it automatically appends that number to the URL. However, when I than use the “back” button in the browser, it simply refreshes the page (most of the time) or changes that number and loads a different thread instead. I’m trying to determine WHAT the number does so I can figure out how to properly create the links so page navigation still works.


(cpradio) #2

It is the ID of the topic (because if the ID exists the lookup can occur faster, otherwise, it has to do a slug lookup which is slightly slower – to my knowledge).


(Khoa Nguyen) #3

That’s post index. This post (which i’m writing right now) is the third post on this topic. What is the number in the topic URL? will go directly to this post.


(cpradio) #4

I don’t think he is asking about the /3, but rather when you visit
https://meta.discourse.org/t/json-codes-doesnt-always-execute/?source_topic_id=24362

It converts to What is the number in the topic URL?

which is the topic ID.


(Khoa Nguyen) #5

Ah. So he is asking about post id right?


(Mittineague) #6

The format is
domain/.../topic title/topic id/post id

As long as the ids are present, the topic title in the URL can be anything and will be ignored in routing the request