בניית קישורים נגישים באינטרנט לפוסטים ונושאים באופן פרוגרמטי

סיכום מבוסס בינה מלאכותית

balazswmann asks about the correct way to construct web accessible URLs for posts and topics using the Discourse API. Falco suggests using the format domain/t/topic_id/post_id, which will redirect to the canonical URL. balazswmann acknowledges this solution. pfaffman notes that another common format is domain/t/-/topic_id/post_id and asks if one is preferred.

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.

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