oEmbed, as the wikipedia page puts it, is an open format for obtaining an embeddable representation of an object. As suggested in the comments in an earlier post, I’ve now extended my Idno Embedded post plugin to support oEmbed.
It works by providing an endpoint that other sites can query, passing the permalink of the thing they’re wanting to embed, a format parameter (currently only json
is supported), and any other content specific parameters (e.g. maxwidth
and maxheight
).
You can pass a permalink of an idno post to this endpoint, and you’ll be returned a JSON data structure containing some details about it. Additionally, if you pass a callback
parameter, you’ll get this data as JSONP, which may be more useful.
Here’s some example code, using jQuery for convenience:
This example makes use of the JSONP callback to update all div elements of class oembed
, with the URL from the data-url
parameter.
Because of this bug, at the moment you’ll need to use my branch of the bonita template library, which applies this fix, in order for the oEmbed functionality to work.
Currently, all posts will default to the 'rich'
data type, however you can extend this by providing your own entity class templates and provide specific details for your own custom types.