What do you need to know about JSS in Sitecore?

What do you need to know about JSS in Sitecore?

JSS extends Sitecore’s dynamic, component-based layout model to the frontend, so to be an effective JSS developer you must also understand how Sitecore composes layouts (or routes).

How to extend the layout service in Sitecore?

These can be used to create app-specific layout service extensions by registering your own. An item lookup is performed based on the item parameter which takes the context site’s start item into account. The logic should match standard Sitecore URL handling.

How are JSS used in the layout service?

The jss portion of this route refers to a particular named configuration of the Layout Service. These can be used to create app-specific layout service extensions by registering your own. An item lookup is performed based on the item parameter which takes the context site’s start item into account.

Can a field name be changed in Sitecore?

Field names can be changed in Sitecore, if you need to e.g.: have them camel-cased, you need do it in Sitecore. So basically serialization configuration is responsible for changing JSON on which user don’t have influence. Changing the Layout Service configuration used by JSS should be done with care.

How does the layout service work in Sitecore?

By using Sitecore MVC pipelines, the Layout Service output will account for any personalization rules and/or content testing in the item’s layout definition. Instead of rendering MVC views, a custom JS serializer will take component’s data source item (s) and will serialize them into a JS object.

How to customize the serialization of a field in Sitecore?

If you wish to customize the serialization of a particular field type, the basic steps are: Create an implementation of Sitecore.LayoutService.Serialization.FieldSerializers.BaseFieldSerializer. Override the WriteValue method and utilize the JsonTextWriter to create your custom JSON structure for the Field.