Enhancements to Embedding Comments


(Robin Ward) #1

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);

Allowing discourse embedded in multiple hosts by category
Embedding with multiple categories?
(Erlend Sogge Heggen) #2

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

(Tobias Eigen) #3

Super happy about this. Thanks much!

(Jeff Atwood) #4