Embedding a list of Discourse Topics in another site

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.

3 Likes

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

3 Likes

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

4 Likes

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

4 Likes

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

https://discuss.flynumber.com/embed/topics?discourse_embed_id=de-zse3f2nh3&template=complete&search=Romania&per_page=5

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

5 Likes

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

4 Likes

This should do it

6 Likes

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.)

3 Likes

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

/embed/topics?discourse_embed_id=XXXXXX....

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.

3 Likes

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"

3 Likes

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:
Selection_920

:thinking:

2 Likes

I see all the requested topics: https://forum.flowster.app/embed/topics?discourse_embed_id=de-k0ofgk7q0&category=17&per_page=5&template=complete&top_period=all

Maybe the div where the iframe lives is too small for you to see the other ones?

2 Likes

@Falco Thanks for your help! Using that link I see multiple topics, however why doesn’t this html code work? Am I doing something wrong with the <d-topics-list> tag?

<!DOCTYPE html>
<html lang="en">
  <head>
	<script src="https://forum.flowster.app/javascripts/embed-topics.js"></script>
</head>
<body>
	<d-topics-list discourse-url="https://forum.flowster.app" template="complete" top_period="all" category="17" per-page="5"></d-topics-list>
</body>
</html>
2 Likes

Does anyone know the answer? Why my HTML code above doesn’t work? :cry:

2 Likes

When google renders a page that features the Discourse topic embed feature it seems to use capital <div> elements.

The below is a screenshot of the rendered HTML from the google search console.

2 Likes

One issue with embedded topic lists is that when an embedded topic list entry is clicked, users are always taken to the first post in the topic. We had a request via our support system to ask if there was anyway that users could be taken to the last post in the topic instead of the first.

If this is something that would be useful for other sites, is there any way that a last parameter could be added to the embed code so that users would be automatically taken to the last post in the topic instead of the first one?

I realize that this goes against the idea that discussions are intended to be read from the beginning to the end, but since it’s not possible to store a user’s last read post on the site that the topic list is embedded on, allowing sites to point users to the last post in the topic might be reasonable for this case.

7 Likes

I thought this was worth bringing up again its sort of a severe SEO issue to have on a page.

The headers for the urls created using the embed topics have a x-robots-tag: noindex,indexifembedded

The indexifembedded is only for the google

It should look more like X-Robots-Tag: googlebot:noindex,indexifembedded

Or perhaps just remove the tag all together.

The real negative is that bing or any other crawler will not index or account for the content displayed by the embed topic. ( because it only picks up on the noindex part )

An example url

1 Like

That is exactly what we want right? I don’t want any crawlers to index anything under /embed/topics directly.

2 Likes

Hi @Falco

Im dont think so as that would mean my example url doesnt get indexed.

https://discuss.flynumber.com/embed/topics?discourse_embed_id=de-d49rj6kge&template=complete&allow_create=true&search=Australia&per_page=5

Google is crawling those urls as separate urls. Distinct from the url the embed topic is displayed on.

It will still crawl my url

https://www.flynumber.com/products/virtual-phone-number/australia

but Bing will get to the embed/topics url , see the nonindex and not count that towards the above url.

While Google wont index the embed/topics url but since it understands the “indexifembedded” it will still count the content towards the page where the embed is displayed.

2 Likes