Sitecore XM & XP

Front-end management

Uniform enables you to use content from Sitecore to power omnichannel digital experiences without depending on Sitecore to management the front-end. But if you already a Sitecore site, you already have a front-end. You have the following options when adopting Uniform:

  • Build an entirely new front-end - You are planning a new front-end and are only using content from Sitecore.
  • Migrating the front-end from Sitecore - You want to retain your existing front-end, but you do not want to manage it usig Sitecore presentation details.

If you are doing a site redesign, you are creating your front-end from scratch. You do not need to worry about migrating your existing Sitecore front-end. Your focus is on creating front-end components that can access content from Sitecore items.

In addition, you may create new front-end components after you have finished migrating renderings & layouts from Sitecore and need to create new front-end components.


This example uses Next.js as the front-end framework, but you can use any front-end technology you want. The layout and components defined in Canvas are technology agnostic.

  1. Open a command-line interface (CLI).
  2. Enter the following commands:
  3. Create a file named .env
  4. Add a file .env and define the following variables:
UNIFORM_API_KEYYour Uniform API key. Use the same value as you configured on the Canvas Integration Service in Sitecore.
UNIFORM_PROJECT_IDYour Uniform Project ID. Use the same value as you configured on the Canvas Integration Service in Sitecore.

The file will look like the following:

In order to add Uniform functionality to your web app, you must add a number of npm packages. Some of these packages are publically available and some require an npm access token.

Enter the following commands:

You must configure Next.js to load Uniform settings when it runs.

  1. Open the file next.config.js.
  2. Change the contents to the following:


Coming soon.

Each component defined in Canvas has a public ID. When you defined the component in Canvas, you specified this value.

When your web app reads composition definitions from Canvas, the composition and the components that are assigned to the composition are identified using this value.

You must provide instructions to your web app on how to map the public ID to the front-end implementation of that component. In your web app, React components provide that implementation.

Create a file lib/resolveRenderer.js:

In Canvas you have a composition that represents the home page and describes the layout for the page. You have a number of React components that represent the implementation of those components. Now you must configure the Next.js app to use the information from the Canvas composition in order to render the page using the React components you implemented.

Replace the contents of the file pages/index.jsx with the following:

About this code

The component Composition accepts props that represent the composition (which is retrieved from Canvas) and a function that resolves the React component that corresponds to the public id for a component from Canvas.

This code also adds a component to render the slot main. You defined this slot when you defined the composition component.

  1. Add the following code to the top of the file pages/index.jsx:
  2. Add the following code to the file pages/index.jsx:

When you retrieve the composition from Canvas, Sitecore item ids are included in the data. You must use an enhancer to retrieve the fields for those items.


Coming soon.

Live preview enables you to view changes you make in Canvas almost immediately after you save them, without having to manually refresh the page.

  1. Create a file lib/useLivePreviewNextStaticProps.js:
  2. Add the following code to the file pages/index.jsx:
  3. Make the following changes:
  4. Make the following changes:
  5. Make the following changes:
  6. In your .env file, add the following variable and set its value so it matches UNIFORM_PROJECT_ID:

When you run the web app, you should see the page from the default Sitecore site, but Sitecore isn't handling page rendering. Sitecore is only acting as a headless CMS.

  1. In the terminal, enter the following command:
  2. Open your browser to http://localhost:3000