Constructing web accessible links to posts and topics programmatically

Hi everyone,

In case of a 3rd party integration when I send a search request to the API endpoint, I get back post and topic properties such as ID, title, author, etc. My question is: what’s the “correct” way to construct a web accessible URL for a post or a topic?

Taking a look to the share links in the forum, I see that they usually follow the https://meta.discourse.org/t/[TOPIC TITLE]/[TOPIC ID]/[COMMENT ID] pattern but I’m not sure this is what I’d need to put together.

domain/t/topic_id/post_id works and will issue a redirect to the canonical URL.

@Falco I see, thank you for the info! That will be perfect I think.

1 Like

I often see domain/t/-/topic_id/post_id. Is one preferred?