BlacklightOembed: oEmbed provider plugin for Blacklight
Description
The BlacklightOembed plugin provides an oembed endpoint for Blacklight records. oEmbed is a format for allowing an embedded representation of a URL on third party sites. The simple API allows a website to display embedded content (such as photos or videos) when a user posts a link to that resource, without having to parse the resource directly. [oembed.com/](http://oembed.com/)
Requirements
A Rails app using Blacklight >3.x.
Installation
Add
gem "blacklight_oembed"
to your Gemfile and run “bundle install”.
Then, run “rails generate blacklight_oembed” to install the oEmbed configuration and hooks into the CatalogController.
Configuration
See ./config/initializers/blacklight_config for oEmbed configuration options, where you can list the default set of document formats (which must be available for every document served).
Injection
This plugin assumes it is in a Blacklight Rails app, uses Blacklight methods, Rails methods, and standard ruby module includes to inject it’s behaviors into the app.
You can turn off this injection if you like, although it will make the plugin less (or non-) functional unless you manually do similar injection. See lib/blacklight_oembed.rb#inject! to see exactly what’s going on.
In any initializer, you can set:
BlacklightOembed.omit_inject = true
to turn off all injection. The plugin will be completely non-functional if you do this, of course. But perhaps you could try to re-use some of it’s classes in a non-Blacklight, highly hacked Blacklight, or even non-Rails application this way.
You can also turn off injection of individual components, which could be more useful:
BlacklightOembed.omit_inject = {
:routes => false,
}