Setting canonical URL when posting/cross-posting

Have a look at Embed Discourse comments on another website via Javascript. I think that will insert the post automatically on discourse and handle the canonical bit.