HOWTO Embed Google Docs in a post/topic

Saptarshi recently posted a Google doc link and it wasn’t working. I’m making this post to test out Google Doc links in Discourse.

1 Like

Strange. Just a blank space in place of the link. :confused:

Hey @michael, any chance we could get the Google docs Onebox for Discourse plugin installed? :smiley:

https://meta.discourse.org/t/google-docs-onebox-for-discourse/26247/14

I was looking at that bug (it’s supposed to be in the general onebox gem no longer a plugin) yesterday and it is on my plate, but my plate continues to get fuller by the day. :smile:

What happens if I link to a document that is publicly viewable? Will I get the “Load denied by X-Frame-Options: (URL) does not permit cross-origin framing” error?

https://docs.google.com/document/d/1IQGdx-1X-E_W3O5PSiV9RF1hhjI5hryWZF9FFYNv4Oc/pub

UPDATE: It turns out that the Google document must be “published” rather than just “shared” publicly. You can do this in Google Docs UI by choosing “File” --> “Publish to the web”.

1 Like

It works! Nice find!

The onebox gem could be improved if it would display a message if the content cannot be rendered. Something like:

This Google document must be published to the web before it can be embedded:

  1. Open the document on Google Drive
  2. In the menu, choose FilePublish to the web...

Agreed an error message would be helpful. (Or at least something besides blank space.) I suggested the same to one of the developers who have worked on the gem, and hopefully they may be able to figure out a way to do that.