Embedding Discourse content in remote pages, like a wiki

AI-generated summary

The discussion explores embedding Discourse content into external pages, such as wikis or WordPress sites. trilson initiates the conversation, seeking ways to embed individual posts rather than entire threads, noting issues with loading all replies and CORS errors. sam explains that Discourse provides a JSON API for content retrieval, making it technically feasible. erlend_sh suggests a bidirectional workflow, where Discourse posts can be embedded in wikis via a Onebox engine. trilson confirms partial success, embedding a static page with a Discourse post, but still faces challenges with fetching only the first post. erlend_sh expresses interest in the workflow and asks about potential use cases, such as linking topics to remote pages or using specific categories. Matthieu requests similar functionality for WordPress, later sharing a solution using AngularJS and a custom WordPress plugin available here. The thread highlights technical possibilities and ongoing challenges in integrating Discourse content into external platforms.

A bit of a long shot, but thought it worth asking. Would it be possible (or is it currently possible) to embed certain types of discourse content in remote pages, similar to how comment embedding works? It’d be great if I could create a community wiki on our discourse site and subsequently embed it on a static site elsewhere.

3 « J'aime »

Technically it is extremely easy to grab the data: Embedding Discourse content in remote pages, like a wiki we have a natural json endpoint for each post and topic you could use. So all you really need to add is a few lines of javascript to pull the content and render it.

3 « J'aime »

I’ve been thinking about this kind of workflow too. Just FYI, I think this could work very well the other way around as well.

  1. Create a new Onebox engine for your wiki that would display the full page instead of an excerpt.
  2. Use Discourse as comments for your wiki pages.
  3. Put the wiki-page’s URL in its respective Discourse thread so that it’s oneboxed.

This looks like what I need, however it appears to return the entirety of the thread rather than a single post. Is there anything I’m missing here? This would be too heavy if there are lots of replies.

I’m also getting the below error when attempting to embed - any workaround for this?

XMLHttpRequest cannot load https://community.muselive.com/t/index-of-b-sides-rare-tracks/73065.json. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://www.muselive.com’ is therefore not allowed access.

After doing a bit of reading, I reckon I might be able to add some rules to support muselive.com with this plugin… currently using it support X-Frame-Options but hopefully extendible.

3 « J'aime »

Update: it works :smile: - example ‘static’ page includes this wiki.

However… I’m still fetching all replies for given a topic’s .json. Is there a way for me to fetch the first post only?

1 « J'aime »

I see the page is now returning a 404. Did you terminate it because of the problem with fetching replies or did you encounter other issues as well?

Unfortunately I can’t help you figure these kinks out, but I’m fascinated with this workflow and would love to know more about it. Regardless of where you’re at with it at the moment, could you tell me what you imagine your final workflow to be like?

  • Could any topic in any category be connected to a remote page, or would you limit it to a specific category?
  • How would new remote pages be added?..
  • strictly at your (and other admins) discretion?
  • or have you pondered ways to automate it? (i.e. users could type
  • Will you be doing any kind of SEO canonicalization in order to indicate your preferred page and avoid possible penalties?

If this workflow gets smoothened out, it could be a great way run a community-powered Discourse wiki.

Sorry, I changed the URL to http://www.muselive.com/b-sides-and-rare-tracks/.
Will respond to your other points when I’m back from work :slight_smile:

nudge!

I’m still really curious :smiley:

Hi I would like to have exactly the same feature but to be embedded on a wordpress page.
Any idea how it could be possible ?

@trilson what techno are you using to build muselive.com ?

Actually I find a way to do it using AngularJS:

And I’m working on a wordpress plugin to do it easily with a shortcode.

2 « J'aime »

I finally take myself to do a wordpress plugin …

2 « J'aime »