Configure placeholders

Current version: 20.x

When your application requests layout data for an item, the Layout Service placeholder resolver builds the JSON response structure based on how you configured your placeholders. To resolve placeholders for JSON-formatted responses, the Layout Service uses placeholder resolvers.

By default, the Layout Service uses the named jss configuration. This configuration uses the Sitecore.LayoutService.Placeholders.DynamicPlaceholdersResolver resolver, and it expects the placeholder keys to be dynamic. You can change the <placeholderRedolver/> node to use the built-in Sitecore.LayoutService.Placeholders.SimplePlaceholdersResolver resolver to use non-dynamic placeholder keys.

To configure placeholders that resolve correctly with either type or placeholder resolver:

  1. In the Sitecore content tree, under /sitecore/layout/Placeholder Settings/Project/<your-app-name>/<placeholder-name>, create placeholder settings.

  2. Add your placeholder to the Layout Service Placeholders field in your rendering item. Alternatively, add your placeholder to the Layout Service Placeholders field in your layout if you are creating a root placeholder.

  3. In your front-end application, enhance your component with the new placeholder definition.

  4. If required, redeploy your application.

Note

Layout Service works only with placeholder settings created globally. All directly added placeholder settings to the presentation of the items are ignored.

Do you have some feedback for us?

If you have suggestions for improving this article,