Embedding a list of Discourse Topics in another site

What could one modify to specify multiple categories?


Should I expect this to work when the “other site” is running locally at http://localhost:8000 and the Discourse site is non-local on an https subdomain? Or would the “other site” also need to be on a “real” domain?

The script file appears to be fetched fine and I don’t see errors in the JS console. The “other site” is a Gatsby/React site; I’m adding the <d-topics-list> element once the page is rendered in the browser via useEffect, and it looks correct to me in the live DOM (see screenshot)…

Screen Shot 2021-05-19 at 9.21.08 AM


Going from https to http usually causes problems, but you can confirm by opening your browser console F12.


Aha, my issue appears to be that React is messing with the client-side DOM, resetting it to match the server-rendered DOM (with the raw <d-topics-list> element) immediately after the embed-topics.js script inserts the iframe.


Anyone know what this error is about??

Latest Discourse Build
Latest Chrome Browser

Refused to frame ‘https://vapingcommunity.co.uk/’ because an ancestor violates the following Content Security Policy directive: “frame-ancestors ‘self’”.


Most likely related to this change: (cc @falco)

Do you have your main site registered under Admin > Customize > Embedding?


Bingo! Didn’t see that change, all working perfectly again, thanks so much :wink:


Does anyone get any “Refused to frame” errors?

I enabled the embed topics and I get

Refused to frame 'https://myforumurl.com/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'".
1 Like

Are you trying to embed your entire forum in another site? That won’t work.

The OP describes how to embed lists of topics on another site, but you can’t run Discourse in an iframe for the reasons that you describe.


No just the latest topics. I followed the instructions to enable the embed topic in settings and copied the scripts to the header and body of the host site. Not sure if the error is caused because the dev site I’m testing it on hasn’t got ssl


This is due to the security settings on your site, not on the Discourse side.


Got it working. Just didn’t read the instructions carefully enough :slight_smile:


So this is working great, my only issue is that Google is indexing the iframe url itself

For example, I have Discourse topics embedded on this page

Google seems to index the above page OK… but its also indexing the below URL’s which I’d like to fix


Is there a way we can get a meta noindex on the above pages? Or even better , get this new google tag on the above pages


Interesting thanks for the tip @nader… should we add this new tag to the <iframe> by default @falco, or make it a setting?


This should do it


Just thought I’d point out this is serving the ' noindex, indexifembedded ' to all crawlers even though its just google who supports the new indexifembedded

This should probably change to x-robots-tag: googlebot:noindex, indexifembedded

Or removed completely as the noindex could have unforeseen consequences on other search engines.

1 Like

I doubt the extra word is particularly harmful to other crawlers. Do you have any evidence that this is the case, e.g. are any other crawlers telling sites not to use indexifembedded?

(Most of the time when writing code like this you tend to ignore any HTML tags you aren’t expecting, that’s sort of the default for HTML.)


I don’t see that but on the google page it does say

Presently, only Google supports the indexifembedded tag.

I agree they’ll ignore the indexifembedded , my worry though is that the noindex causes SEO issues for the page its on.

So lets let bing crawls a url that has topic embeds. It crawls that URL and also crawls the embed URL


If the above is noindex , I’m worried it hurts the SEO for the page that is featuring the topic embed

This is all fixed by using x-robots-tag: googlebot:noindex, indexifembedded but could understand why Discourse may not want to favor 1 Search engine. Hopefully, it becomes standard but for now it seems it’s just google.


Hi there! Just wanted to ask if there’s still no built-in way to make embedded topics open as target="_blank" instead of target="_parent"


Just curious why I can only get it to show 1 topic? Does anyone know?

Here’s the category (that has many topics): Amazon Specific - eCommerce Sellers Forum

And the embed code:
<d-topics-list discourse-url="https://forum.flowster.app" template="complete" top_period="all" category="17" per-page="5"></d-topics-list>

But only one topic appears: