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.
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.
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.
- Create a new Onebox engine for your wiki that would display the full page instead of an excerpt.
- Use Discourse as comments for your wiki pages.
- 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.
https://github.com/trilson/discourse-xorigin/blob/master/plugin.rb
Update: it works - 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?
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
nudge!
I’m still really curious
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:
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.
I finally take myself to do a wordpress plugin …