Embedding not working in Expression Engine page

I’m trying to get embedding set up on my site. Topics are being created in my Discourse forum, but the topic and replies are not showing up on my site.

The site uses Expression Engine. It’s a PHP-based CMS. But all pages are cached & delivered as flat html.

Here’s the embed code on this page

<div id="discourse-comments"></div>

<script type="text/javascript">
  var discourseUrl = "http://forum.coastsider.com/",
      discourseEmbedUrl = 'http://coastsider.com/site/news/testing_led_lights_on_the_midcoast';

  (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>

Likely due to the extra slash in the URL? Double check your settings, please.

What do you think @eviltrout?

I deleted the slash in the URL, but that didn’t help.

I solved the problem. Expression Engine uses curly braces to indicate variables, so it was changing the Javascript.

The solutions is to put the braces on separate lines, per the EE site on Stack Overflow:

2 Likes