Creating an Open Graph Request Handler

To create a site-specific Open Graph request handler:

  1. Copy OGPRequestHandler.properties from the CUE Live installation into your webapp configuration layer (not the common configuration layer), and rename it appropriately. For Flickr, for example, you might enter:

    $ cp engine-installation/plugins/live/misc/siteconfig/com/escenic/livecenter/service/proxy/OGPRequestHandler.properties \
    > /etc/escenic/engine/common/com/escenic/livecenter/service/proxy/FlickrOGPRequestHandler.properties
  2. Open the copied file for editing and set the following properties as required:

    urlPatterns

    A comma-separated list of host names (not URL patterns as listed here) for which this handler is to be used. For Flickr, for example, you might want to set this property as follows:

    urlPatterns=flickr.com,flic.kr
    blockCodeTemplate

    An HTML template from which the embedding code for your web pages will be generated. The template is generated using Mustache, a popular templating language. At its simplest, this means you can include Open Graph property values in your template by enclosing the property name in double braces thus:

    {{property-name}}

    Mustache also offers more sophisticated functionality such as conditional processing, allowing you to construct more complex templates.

    Instead of specifying a template directly in the blockCodeTemplate property, you can specify the path of a file in which you have saved the template. For example:

    blockCodeTemplate=file:/path/to/block/code/template

    The path must be specified as a file system URL (that is, it must have a file: prefix). The URL must be absolute.

    providerName

    The name of the provider for which you are implementing this handler (Flickr, for example). This property is optional: if you don't specify it, then the value returned for providerNameKey is used instead.

    providerNameKey

    The name of the Open Graph property that the handler is to use as a provider name. This property is optional. If you don't specify it (and you haven't specified providerName either), then the provider name is read from the provider site's og:site_name property.

  3. Register your request handler as described in Register Request Handlers.