Embedding Discourse in static sites does not work: Discourse Posts are not generated for blog entries

I’ve switched to a docker based discourse installation and can’t get the embedding to work. It has worked fine with the old installation following http://eviltrout.com/2014/01/22/embedding-discourse.html.

I did not change anything on the blog, where the discourse posts should be embedded for comments. I set

  • embeddable hosts
  • feed polling enabled
  • feed polling url
  • embed by username
  • embed category

But discourse just doesn’t create the posts for the blog entries. The feed URL is correct. The logs and error logs are empty.

How can I diagnose the issue? Is there a way to forcefully re-trigger the blog post creation or something like that?

Did you check the javascript logs in the developer console of the site embedding your discourse site? If there’s nothing there, try checking the network tab and seeing if a request is being made to your server.

Thanks @eviltrout. So far I got

Refused to display ‘http://forums.xy.eu/embed/comments?embed_url=http%3A%2F%xy.eu%2Fflow%2Fposts%2F2014-09-24-post.html’ in a frame because it set ‘X-Frame-Options’ to ‘SAMEORIGIN’.

Can you double check that your embeddable_host matches the server you are embedding it in?

After removing and adding a few hosts to embeddable hosts it suddenly worked. I’m nearly 100% positive that I had entered the correct host domain. The only difference I spot now is that it is now without a trailing slash ‘/’. E.g. instead of

myblog.org/

I have now

myblog.org

not sure if this could have been the culprit.

2 Likes

Yes, that would do it.

1 Like

Ahh, ok. Then I’d like to state the feature request to ‘normalize’ entered URLs for embeddable_host, e.g. remove http(s):// and a eventually existing trailing slash.

We should have better protection here @eviltrout if possible.

1 Like

Okay, I’ve made it really robust now. It will support URLs with http/s and even trailing paths:

https://github.com/discourse/discourse/commit/b02d624503e0bf24840fabfa9b8433250204478f

3 Likes