Contents
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.
How to add context data to layout service?
The getLayoutServiceContext pipeline allows you to add context data which is returned with particular Layout Service configurations and/or JSS apps. Context data appears under the context object in the LS output. See the Extending Route Context Data Recipe for more information.
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 do you add fields to an item in JSS?
To add fields to an item, you need to do it on a data template. JSS allows you to define fields for custom “route types” which will be imported as new data templates.
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.
Do you need a Sitecore server for JSS?
In order to deploy a JSS app to Sitecore, or to pull data from a remote Sitecore instance into a headless JSS app, a Sitecore instance running the Headless Server Components is required. You do not need these prerequisites to perform disconnected development on a JSS site, or to quickly try out JSS.
How to prevent direct access to CSS and js files?
The best you can do is obfuscate the sources. You could do this by using a processed language – such as Stylus or LessCSS for CSS, and Coffeescript for JS – or by making the delivery more complicated. You could minify the script files, or even have them dynamically generated and fetched (in small pieces) by another JS file.