So after a bit of tinkering, I’d like to present the following approach. The example is in Vue.js, however, it can be easily adapted to other frameworks/libs.
Note: I will use the term blog posts where a Discourse comments section should be embedded. But of course this can also mean individual pages on your site.
1. The issues in 
<script>...</script> snippet you are told in  to insert into your HTML will thus not be part of the implementation we are approaching here. We will utilize some bits of
We will utilize the RSS Polling plugin to provide the necessary data and create the topics for us.
Create an endpoint on your site which provides an RSS or Atom feed for the RSS Polling plugin. This endpoint can either be just a static XML formatted file or a server-side function providing the XML formatted content, example:
<?xml version="1.0" encoding="utf-8"?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>My Site Blog Posts</title> <link href="https://mysite.com/blog/"/> <updated>2022-07-03T09:02:48.721Z</updated> <id>urn:uuid:790c1857-b968-49cc-9fbd-bf7afe3552c2</id> <entry> <title>An Article about Technology</title> <author> <name>Your Name Here</name> </author> <link href="https://mysite.com/blog/an-article-about-technology"/> <id>urn:uuid:f6cc13e4-d2eb-4385-af28-c867a94f48dc</id> <published>2022-07-03T00:00:00Z</published> <updated>2022-07-03T00:00:00Z</updated> <summary>Let's discuss some technology in this article.</summary> </entry> </feed>
Recommended Settings for RSS Polling in Admin → Settings → Plugins:
|rss polling enabled||true|
|rss polling frequency||10 (i.e. 10 minutes)|
Add a new feed in the RSS Polling plugin configuration at Admin → Plugins → RSS Polling
Configure it as per :
Discourse uses the last part of the URL path as the identifier for an individual blog post.
Configure your SPA router accordingly, so that individual blog posts correspond with individual URLs.
Also: Discourse will provide a link back to the individual blog post, so it is good UX that when clicked, your site shows the actual article.
As told before, we can’t use the approach with the
<script></script> from . So we implement the iframe and some functions from
Things you should edit:
|#YOUR-DISCOURSE-URL#||the URL of your Discourse instance, e.g.
|#YOUR-SITE-URL#||the URL of your site, e.g.
Now with the RSS/Atom Feed polling in place and the implementation on your site, we can finally configure the embedding on the Discourse instance.
Go to Admin → Customize → Embedding and add a host:
|Allowed Hosts||your site base URL> e.g. “mysite.com”|
|Class Name||optional class name for styling|
|Path Allowlist||e.g. “/blog/.*”|
|Post to Category||same category as configured in RSS Polling Category|
The RSS/Atom feed polling as well as Discourse itself will create a new topic if it does not exist for the individual blog post. Ensure that the RSS/Atom feed polling comes first (i.e. wait until the topic is created before you visit the blog post on your site).
Reason: Discourse can’t scrape the title and summary, so the topic would be
mysite.com with the summary being
If for some reason Discourse came first, you can just delete the topic and wait until the RSS/Atom feed kicked in.