js-discourseBestOf
js-discourseBestOf is a jQuery based wrapper for the wp-discourse plugin for discourse.
Read about it! at it's place on meta.discourse.org
This is just the javascript part, for developers who don't need the jekyll intergration. Create a div tag with ID of comments, and a topic ID and it'll do the rest.
For example:
<div id="comments" tid="200"></div>
will populate the div tag with the "best" posts of topic ID 200, as specified in the javascript file.
You need to set the Access-Control-Allow-Origin header for discourse. That's as simple as:
add_header "Access-Control-Allow-Origin" "*";
in nginx!
This allows all sites to load your content via javascript. If you would like, replace the * with the public location of your jekyll install, including http://. The security of this is debated all over, but I find it safe. For more security, add the header only to your json files using a location block!
Read the guide over here for how to intergrate the two together.
Extra Notes
I've detailed some of the implementation in the posts above, but if you use some other kind of site generator all you need to create is a div/span with an ID of comments, and an attritube called "tid." Then, you can just load the javascript and comments will render in that space. The topic ID is the number that follows after /t/<post-slug>/
and is not the last number.
And if you're really looking to build it out in some other kind of framework I'd recommend looking at the original wp-discourse. Or, just load up /t/<topicID>/wordpress.json?best=number
and parse it from there.