Enhancements to Embedding Comments

I checked in two enhancements to embedding comments on remote sites today:

You can now embed comments on multiple hosts. Just use the + button to add more.

You can also embed to an existing topic without creating it. Normally embedding is meant to create the topic, but some people want to create the topic in advance and then embed its comments elsewhere. To do this, grab the topicId from the URL. The topicId is the number that immediately follows the slug. For example given the URL http://meta.discourse.org/t/hello-world/12345/2 the topicId is 12345.

Use this slightly different embed code to embed by topic. Replace discourseUrl and topicId with your values:

<script type="text/javascript">
  var DiscourseEmbed = {
    discourseUrl: 'http://meta.discourse.org/',
    topicId: 29425

  (function() {
    var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
      d.src = DiscourseEmbed.discourseUrl + 'javascripts/embed.js';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);

Oh joy! That’s one major step closer to having this:

1 Like

Super happy about this. Thanks much!

1 Like