Embedding Discourse Comments *without* Javascript

There is this great post on how to Embedding Discourse Comments via Javascript. However, there are communities where website visitors may not be running javascript. And if not for that, I would argue from the SEO perspective that there should be a way to embed site comments without javascript.

After paying a bit around I find that it can be easily implemented in a much simpler way without any javascript. It’s just a matter of following:

<iframe id="discourse-embed-frame" scrolling="no" referrerpolicy="no-referrer-when-downgrade" 
width="100%" height="3271px" frameborder="0"></iframe>

For example:

<iframe src="https://meta.discourse.org/embed/comments?embed_url=https%3A%2F%2Fblog.discourse.org%2F2021%2F05%2Fdiscord-and-discourse-better-together%2F&amp;discourse_username=rishabh" 
id="discourse-embed-frame" scrolling="no" referrerpolicy="no-referrer-when-downgrade"
width="100%" height="3271px" frameborder="0"></iframe>

Is there any reason why wouldn’t work?

1 Like

It’s a myth that modern search engines can’t execute Javascript. The embedding is much more powerful because of the Javascript usage and there are no plans to add an alternative at this time. You are free to use Discourse’s APIs to retrieve the same content server side and render it that way.


I see. However, from my little testing the above mentioned method does work without any changes. My question stemmed from possible edge-cases where it could break and that I was not thinking about.

Yes, that would be the other route.

Can you provide an example? I fail to see how they differ if the end result is the same iframe.

1 Like

The Javascript is not doing nothing. It’s used for automatic sizing and scrolling. It also provides an easier API by looking for optional parameters.

It is the only supported way of doing this. If you find the <iframe> works for your purposes you can use it in an unsupported way.