You can create contexts within Matrix to allow you to construct multiple versions of single assets within the system. This feature enables creating multiple versions of pages within a site that you can use to construct multi-lingual sites and mobile or internal versions.
Multiple context sites utilize the system’s default context and any number of user-created alternate contexts. In the following figure, a standard page asset has been created in four different language versions; an English version of the page acting as the default context and alternate contexts displaying the page in Japanese, French, and Portuguese.
These pages can cater to specific users through the use of context detection. In the example above, conditions for context detection can be set so that a user whose browser language is set to French will automatically view the page’s French version.
Assets that utilize contexts
|Not all asset information can be edited over multiple contexts.|
Asset attributes, such as a standard page asset’s contents, as configured on a bodycopy div, can be edited over multiple contexts.
However, you cannot edit information such as the file contents of an image or PDF file asset over multiple contexts.
Additionally, the following assets and functions contain some degree of context-awareness:
Listing assets (such as an asset listing, search page, or site map) can return results stored against a specific context.
Metadata Field values and their defaults can be configured separately for multiple contexts. Metadata can also be set as non-contextable, maintaining assigned values across all contexts.
Paint layouts are rendered on a site by the currently viewed context. This feature means that Matrix will display any paint layouts in their corresponding context (if a site is being viewed in an alternate context), allowing the content of layouts to be customized for each context.
Read the Using contexts documentation for more information on context-awareness within Matrix.
Context configuration screen
The Context configuration screen allows you to manage your system’s default context and create an alternate, setting conditions for when those contexts are to be viewed on the frontend.
Clickto access the context configuration.
|Read About the Matrix user interface for more information about the layout of the Matrix user interface.|
List of current contexts
This section lists the system’s current contexts, including the default context and any alternate contexts that have been created.
This section displays the default context for the system. This context will be used when no alternate contexts have been created or if none of the alternate contexts' conditions can be matched and no alternate base context has been assigned.
|You cannot configure the conditions and order of this context.|
To edit the name of the default context:
Click on the Edit icon. The Edit selected context section will be displayed at the bottom of this screen.
In the Name field, enter a new name for the context.
The default context’s new name will be displayed in the context name column.
This section displays any configured alternate contexts for the system. These contexts are used to create multiple versions of assets within the system. By default, no alternate contexts are displayed in this section.
Because there are no alternate contexts, the default context is always used, and multi-context versions of assets will not be available.
When alternate contexts have been created, they will be listed in this section.
As these contexts do not have any defined conditions, they are not valid and will not be used within context detection. When a context contains a set of achievable conditions, it will be deemed valid.
Click on the Edit icon to add and edit the conditions of an alternate context.
Alternate contexts are evaluated in descending order for context detection. This feature means that in the example above, the system will first attempt to match the French context’s conditions. If the conditions are matched, the system will display this context; if not, the system will attempt to match the Swedish context’s conditions.
Click on either Up or Down arrows to re-order the contexts to change this evaluation’s order.
Click on the Delete icon to delete a context.
If the system can match no alternate contexts' conditions, it will display the asset’s base context. By default, this is the system’s default context.
Read the Using contexts documentation for more information.
Create a new alternate context
This section allows you to create alternate contexts for the system. To create a new context:
Select the Create a new alternate context checkbox.
Enter a name for the context.
This context will now appear in the alternate contexts section.
You can then add conditions to the context in the Edit selected context section.
|If you have created new alternate contexts, you will need to re-index the assets within your system. You can do this on the system’s search manager asset.|
Read the Search indexing and weighting documentation for more information.
Edit selected context (alternate contexts)
When first creating or editing an alternate context, the Edit selected context section will appear, allowing you to edit the selected context’s conditions.
The following fields are available when editing an alternate context:
The name for the alternate context.
- Minimum matches
Select how many conditions the context must match before being selected. The following options are available:
- At least
Enter the minimum number of conditions that must match the selected context.
All of the set conditions must be matched for the context to be selected.
Configure the condition type and condition details for any conditions set for this context. By default, no conditions are displayed in this field. Conditions must first be added using the new condition field before they will appear here.
- New condition
Check the Add a new condition checkbox and select a condition type to add a new condition to the context. The following condition types are available:
Accept-language request header
Other request header
URL of request
Conditions for context detection
Conditions can be used when editing an alternate context to enable context detection, determining which context of an asset to show for individual users on the frontend.
Read the Context configuration screen section for more information on configuring alternate contexts.
The details of the condition types that are available for use in an alternate context are outlined below.
Accept-language request header
This condition type will match if a specified language is found in the accept-language header of the request. The accept-language request header condition options are shown in the figure below.
The following fields are available:
- Match the following language
Select a language to match the language preferences of the user request. For example, selecting Japanese would automatically match and use this context for users who have their browser language set to Japanese.
When a language contains many country-specific variations, selecting the primary language will also select all child variations. For example, selecting English will also select English (Australia), English (United Kingdom), and so on, rather than selecting English (Australia), which would only select that specific variation of English.
- Only match the language if quality >=
Enter a language quality value to determine the minimum quality value to match this condition. This value must be between
1.0. Quality values represent estimations of a user’s language preferences, with no quality value (the equivalent of a value of
1.0) indicating the most preferred language. For example, if the accept-language request header condition is set to French and you only want this condition to match users whose browser’s most preferred language is French, you would set this to
Other request header
This condition type will match if the request header rule is met in a specified header of the request. The other request header condition options are shown in the figure below.
In the Other request header field, enter the header’s name against which you want to match the other request header rule. Select either Does or Does not from the first list provided and either Exactly match, Begin with, End with or Contain from the second list provided. In the text field, enter a value to be matched against the header specified in this rule. For example, if this field reads match if the header named Referer does contain Google, the condition will match if the referer header of the request contains the value Google (for example, the user has been redirected from a Google search).
|If the match type is Does/Does not exist, no value needs to be entered into the text field.|
URL of request
This condition type will match if the URL used to access an asset matches/does not match a specified URL rule. The URL of request condition options is shown in the figure below.
In the URL of the Request field, select either Does or Does not from the first list provided and either Exactly match, Begin with, End with or Contain from the second list provided.
In the text field, enter a value that will be matched against the access URL, as determined by the URL of the request rule.
For example, if this field reads match if the request URL does contain
fr, the condition will match if the access URL contains the value
fr (for example, http://www.mysite.com/fr/home).
This condition type will match if the port used to access Matrix is/is not matched to a specified port. The destination port options are shown in the figure below.
In the Destination port field, select either Is or Is not from the first list provided and enter a port number that will be matched against the access port, as determined by the destination port rule.
By default, this field value will be
80, the default port for HTTP requests.
The default port for HTTPS requests is
This condition type will match if a secure connection is/is not being used to access Matrix, as determined by the connection rule. The secure/insecure connection condition options are shown in the figure below.
In the Secure/insecure connection field, select whether the condition will match Secure (HTTPS) or Not secure (HTTP) connections.
|This condition may be affected by proxies such as an SSL accelerator unless configured properly on the Proxy configuration screen.|
This condition type will match if the GET variable rule is met in a specified GET variable of the request. The GET variable condition options are shown in the figure below.
In the GET variable field, enter the GET variable’s name against which you want to match the GET variable rule. Select either Does or Does not from the first list provided and either exactly Match, Begin with, End with or Contain from the second list provided. In the text field, enter a value to be matched against the GET variable specified in this rule.
This condition type will match if the POST variable rule is met in a specified POST variable of the request. The POST variable condition options are shown in the figure below.
In the POST variable field, enter the POST variable’s name against which you want to match the POST variable rule. Select either Does or Does not from the first list provided and either exactly Match, Begin with, End with or Contain from the second list provided.. In the text field, enter a value to be matched against the POST variable specified in this rule.