Out of box layout service configuration - jss-rendering

212 Views Asked by At

In Sitecore (10.2.0) there are serval out of box layout service configurations, such as default, jss, jss-rendering etc.

I used default and jss in my headless project, but I'm wondering what is jss-rendering configuration for?

1

There are 1 best solutions below

0
Kate Orlova On

jss-rendering configuration option stands out against other named configurations of the Sitecore Layout Service for two reasons:

  1. its IncludeServerUrlInMediaUrls property is set to false to instruct Sitecore not to include the server host as part of media requests; it is helpful to exclude the server host from media URLs when proxying requests in headless mode;
  2. it uses Sitecore.LayoutService.Placeholders.SimplePlaceholdersResolver resolver to use non-dynamic placeholder keys.

Here is a config example of the jss-rendering option for the Layout Service:

   <config name="jss-rendering">
      <rendering type="Sitecore.LayoutService.Configuration.DefaultRenderingConfiguration, Sitecore.LayoutService">
        <placeholdersResolver type="Sitecore.LayoutService.Placeholders.SimplePlaceholdersResolver, Sitecore.LayoutService" />
        <itemSerializer type="Sitecore.JavaScriptServices.ViewEngine.LayoutService.JssItemSerializer, Sitecore.JavaScriptServices.ViewEngine" resolve="true">
          <AlwaysIncludeEmptyFields>true</AlwaysIncludeEmptyFields>
        </itemSerializer>
        <renderingContentsResolver type="Sitecore.LayoutService.ItemRendering.ContentsResolvers.RenderingContentsResolver, Sitecore.LayoutService">
          <IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
        </renderingContentsResolver>
      </rendering>
      <serialization type="Sitecore.LayoutService.Configuration.DefaultSerializationConfiguration, Sitecore.LayoutService" />
    </config>