Documentation

Context - How, who and where?

A bemoko context is the context of the user's intent. It has several properties:

  • device - including the variation in device capabilities
  • profile - user preferences, user segmentation

Context Expressions

Many of the concepts in bemoko are defined against context expressions and allow you to enable and disable functionality or implementations based on the context, for example:

enable when device is a mobile device

device.isMobile

enable when the width is less than 176px

device.displayWidth lt 176

enable for intent names starting with cms and when the user is in the group called "admin"

intent.name.startsWith('cms') and user.person.inGroup('admin')

enable when the uri does not start with "/lib/" or does start with "/lib/dynamic"

uri.startsWith('/lib/') or uri.startsWith('/lib/dynamic/')

Context expressions are most typically applied using the expr attribute in the site configuration files against the following configuration points:

  1. Content sources
  2. Headers
  3. Intents
  4. Templatable mime types
  5. Tweakers

For example,

<content-sources>
  <source name="cms" plugin="ContentManager" scope="request" 
      expr="intent.name.startsWith('cms')"/>
</content-sources>

More