Embedding Discourse content in remote pages, like a wiki


(Thomas Wilson) #1

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.


Proposing Jekyll as community wiki platform
(Sam Saffron) #2

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.


(Erlend Sogge Heggen) #3

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.

(Thomas Wilson) #4

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.


(Thomas Wilson) #5

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.


(Thomas Wilson) #6

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?


(Erlend Sogge Heggen) #7

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.


(Thomas Wilson) #8

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:


(Erlend Sogge Heggen) #9

nudge!

I’m still really curious :smiley:


(Matthieu) #10

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 ?


(Matthieu) #11

Actually I find a way to do it using AngularJS:

https://forum.poppy-project.org/t/publishing-your-own-project-on-poppy-project-org/1462

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


(Matthieu) #12

I finally take myself to do a wordpress plugin …