Enhancements to Embedding Comments

AI-generated summary

eviltrout announced two significant enhancements to the embedding comments feature on remote sites. First, users can now embed comments on multiple hosts simultaneously by utilizing the + button to add additional domains. Second, the system now supports embedding into an existing topic rather than strictly creating a new one. To use this, users must extract the topicId from the URL (the number following the slug) and implement a modified JavaScript snippet that specifies both the discourseUrl and the topicId. erlend_sh expressed enthusiasm, noting this update is a major step toward fulfilling the request to use existing forum topics for new WordPress posts. tobiaseigen also shared their excitement and gratitude for the improvements.

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);
  })();
</script>
16 curtidas

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

1 curtida

Super happy about this. Thanks much!

1 curtida