oEmbed support

Hello,

I am wondering if oEmbed support exists or could be considered - I couldn’t find the relevant meta tags on the notebook page. Happy to file a Github feature request if it makes sense to folks here.

Thanks,
Karim

1 Like

Hey Karim,

So, we’ve considered adding oEmbed support, and here’s where my research ended up - feel free to correct if there’s something amiss.

The gist is that every oEmbed consumer now relies on a whitelist - here’s Wordpress’s, and here’s Embed.ly’s, which is what Medium uses (and is now an acquired company of Medium’s). Until you’re allowed to be on the whitelist, implementing oEmbed doesn’t do anything.

Facebook and Twitter don’t support oEmbed and instead rely on OpenGraph or twitter-specific markup.

So, unfortunately, as far as I can tell, if a website today implements oEmbed, there isn’t a single consumer that can consume that embed, because virtually all of them rely on whitelists, and centrally control those whitelists.

At this point I think we could get the approval required for oEmbed to work in WordPress, Medium, or both. But early on this was the blocker, and it’s still, well, personally a bummer to see what was an open standard become something that aggressively gatekeeps implementations.

However, let me know if there are implementations that would work that don’t rely on a whitelist - that’d be very useful to confirm that oEmbed works, if we do end up implementing it.

-Tom

Thanks Tom for the thorough reply. Yes, it’s unfortunate that big platforms should whitelist oEmbed providers, but it’s not wholly surprising given that arbitrary JavaScript can be injected in their app this way. I am actually surprised that OG and Twitter tags are not subjected to the same restrictions.

I also think that Observable would very probably be whitelisted pretty easily, especially if you only embed a thumbnail and not the actual notebook engine. The app I’m working on was also whitelisted as an oEmbed provider by Embedly/Medium without too much drama.

I do still think oEmbed is a useful feature to have, considering the huge “long tail” of CMS installations on the web, whose users would appreciate the capability to enrich their content’s presentation. At the core, systems like Drupal and WordPress support oEmbed and the whitelisting is at the discretion of the site administrator.

In any case, thanks for a wonderful platform!

1 Like

I want to re-up this request for oEmbed support! We use Wagtail as our CMS, which comes with an embed block that lets content editors add oEmbed content to pages and articles.

We mostly use this to embed Tweets and YouTube videos, but we’d love to be able to use it to embed charts and, for all of future-proofing, user-experience, and security reasons, we vastly prefer letting content editors specify a URL to embedded content rather than entering raw HTML.

4 Likes

oEmbed would be super cool! In case anyone is interested, I’ve created a Wordpress shortcode to easily embed notebooks/specific cells there, with dynamic resizing to parent containers. Feel free to jump in there and improve it!

https://github.com/andybrowncompassion/observable-embed

@andybrown Observable’s oembed provider spec got published in October 2020. Any plugin that supports oembed should also support Observable embeds.

oEmbed doesn’t appear to work in Wordpress. Dropping this url into a block in Wordpress recognizes that it could be an embeddable source but fails to load.

https://observablehq.com/embed/@d3/bar-chart?cells=chart

Looks like Wordpress doesn’t support just any old oEmbed provider, but you can register observablehq.com in your theme’s functions.php file by adding this:

wp_oembed_add_provider( 'https://observablehq.com/*', 'https://api.observablehq.com/oembed' );
1 Like

Perhaps the better solution is in any case your wonderful new WordPress plugin, @andybrown !

1 Like

Thanks, @Cobus . That register code does work for Wordpress. There are some advantages with the plugin, but this is also a great solution!