Can't get discourse embedded properly into Ghost

Hi all,
I followed @eviltrout 's awesome tutorial here http://eviltrout.com/2014/01/22/embedding-discourse.html but can’t get it to work properly.

This is how it looks embedded :

<div id="discourse-comments"></div>
<script type="text/javascript">
var discourseUrl = "http://discourse.ars-artificia.com/",
discourseEmbedUrl = 'http://ars-artificia.com/Spring cleaning';
(function() {
var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
d.src = discourseUrl + 'javascripts/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);})();
</script>

see https://ars-artificia.com/spring-cleaning/ for reference.
My discourse is set up accordingly. I am using ghost to host my blog - I don’t get any changes.
Thanks in advance !

For reference here is how @codinghorror embedded discourse in his blog

</article>
<div id="discourse-comments"></div>
<script type="text/javascript">
      var discourseUrl = "http://discourse.codinghorror.com/",
          discourseEmbedUrl = 'http://blog.codinghorror.com/the-god-login/';

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

and this is my current version:

</footer>
    </article>
	<div id="discourse-comments"></div>
	<script type="text/javascript">
		var discourseUrl = "http://discourse.ars-artificia.com/",
		discourseEmbedUrl = 'https://ars-artificia.com/spring-cleaning/';
		(function() {
			var d = document.createElement('script'); d.type = 'text/javascript'; d.async = true;
			d.src = discourseUrl + 'javascripts/embed.js';
			(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(d);
		})();
	</script>

Edit: Found the solution !!
As my discourse instance isn’t ssl secured yet, I embedded non-secure content on a secure website. This was blocked in my browser (firefox) because of security issues ! In e.g. interntet explorer everything works fine :smile: thanks a lot for the help, @bartv and @Mittineague !
ISSUE SOLVED

Edit: Grabbed some new ssl certs and verified everything is working properly now. Remember that you can’t simply embed non secure content into a https site !

1 Like

Change the forum so it doesn’t require being logged it to access it.

Thanks for the suggestion. Porting the posts worked anyway - I changed it but the comments still do not appear. Might be an issue with the ghost templating

“Spring cleaning” is not the same as “spring-cleaning”

Make sure discourseEmbedUrl is the canonical URL to the page where you are embedding Discourse.

ah damn. Thanks for pointing that out !

fixed it, but it’s still not working :confused:

Are you seeing any errors in the discourse server log? I battled this for a while too.

1 Like

the log I can see on my discourse webui doesn’t show anything. is there a log on the filesystem I need to check as well ?

If you’re using a docker installation, I believe you should be able to find those in

/var/discourse/shared/standalone/log/var-log

The syslog states nothing unusual and there aren’t any error logs present =/
I’m kinda out of ideas right now, so I’d gladly take any advice …
Edit: Found the solution !!
As my discourse instance isn’t ssl secured yet, I embedded non-secure content on a secure website. This was blocked in my browser (firefox) because of security issues ! In e.g. interntet explorer everything works fine :smile: thanks a lot for the help, @bartv and @Mittineague !
ISSUE SOLVED

2 Likes