What’s the best practice for embedding an book preview from
Google books provides both a plain link and an iframe, but neither of them work out of the box:
By “don’t work” I mean they don’t give me a onebox when pasted into discourse.
The only solution I see at the moment is to whitelist
google.books.com using @simon’s whitelist-iframe plugin. Is this the best/only way forward?
Take a look here
https://discussbook.com/ and here
I think that site add a js script and a
script src to include the API library
Developer's Guide | Google Books APIs | Google Developers
That books integration looks fascinating (though the previews don’t seem to work, I just get an empty lightbox). What I had in mind was oneboxing the preview, but this might also work (when it works), maybe even better.
I will have to look into that source code later to see what in those 1383 lines is relevant here (I am not a programmer).
Are you saying that the whole integration is done only via JS, no discourse plugin?
I’m not sure, but you can ask to
@net_deamon (see Discussbook on discourse, anybody interested? Not paid, but collaboration).
If he wrote a plugin you can ask him to share it
I have successfully added google books to the iframe whitelist using the whitelist-iframe plugin.
and it works just perfectly when pasting the iframe code that google books provides by default.
A plugin has been released today:
discourse-googlebooks is a plugin for integrating google books with discourse. This plugin has been built to specific needs of site I run ie https://discussbook.com. Nevertheless, I feel that this plugin can be useful for people integrating google books with their site.
Here are some screenshots from the plugin
Screenshots from the plugin
1. Editor integration
2. Category Settings
3. Topic integration. Link to this post
I know, I ordered some customizations for it