Creating a Site with Multiple Contexts

Last Updated: 11 May 2018

To understand how to set up a multi-context Site, consider the following example.
We want to create a Site with both English and French contexts, with the context being displayed determined by a user’s browser language preference.

Note that if you are using any sort of proxy/accelerator caching in front of your Squiz Matrix instance, switching context based on the browser language will most likely not work. It will only work if your caching layer supports multiple cache entries per URL, or if the pages aren't cacheable at all.

To set up this multi-context Site, follow the steps outlined below.

  1. On the Context Configurations screen, create a new Alternative Context for the French version of your Site. The system’s Default Context will act as the default English Version of the Site.
  2. Edit the French Version context, creating a new condition of type Accept-Language request header.
  3. On the Accept-Language request header options, select French as the language to match and enter a quality value of 1.0. This will mean that only users whose main language preference is French will view this context.

    The English and French version contexts will be listed in the Current Contexts section, as shown in the figure below.

    The Default English Version context and the Alternate French Version context
    The default English Version context and the alternate French Version context

  4. The Change Contexts list
    The Change Context list

    Create a Site, with a Standard Page as the Index page.
  5. Edit the contents of the Standard Page with English text and images.

    Now, select the French Version context in the Change Context list in the info bar, shown in the figure to the right. The edit contents page will refresh, containing the English content previously entered.

  6. Alter the contents of the Standard Page to create a French version of the page.

    Once you have Committed your changes, you will be able to switch between the English Version and French Version contexts, noting that they retain their language specific content, as shown in the figures below.

    The English and French content of the Site
    The English and French content of the Home page

  7. When a user accesses your Site, the context displayed will be determined by their browser language preference. A user with a main browser language of French will be shown the French Version context of the Site, while all other users will be shown the default English Version context. The different language versions are shown in the figures below.

    The English version of the Site
    The English version of the Site

    The French version of the Site
    The French version of the Site