I think that what you are trying to do is outlined here https://meta.discourse.org/t/embed-discourse-comments-on-another-website-via-javascript/31963#alternate-configuration-linking-to-existing-topics-6
That would be useful for the case where you want to link existing posts from an external site with existing Discourse topics. That code would need to be added to each of the external posts that you wanted to link to Discourse. For each post, you would need to set the topicId
parameter to the ID of the Discourse topic you wanted to link to.
If this doesn’t solve the problem for you, can you explain what you are trying to do in more details?