Hot answers tagged

5

This issue can happen due to incompatible version of JSS app with sitecore version. Can you verify what version you have used when creating your jss app? For sitecore 9.3 you need to create jss app using release/13.0.0 by this syntax: jss create appname react -b release/13.0.0. You can verify the JSS module compatibility with the sitecore version on the page ...


4

Handling other error codes is not configured OOTB, but it can be added in your project. Assuming your JS project is based on one of the sample apps, the call to Layout Service for page data is handled by dataApi.fetchRouteData (from the sitecore-jss package), which takes an options object. These options can be used for points of customization. One of the ...


4

The React JavaScript SDK can work with Sitecore tracking and analytics via the Headless Proxy. In "headless mode," all requests are proxied through the node instance, which is also doing server-side rendering of your application. This means that the Sitecore Analytics cookie is associated with the domain of the node server. If you create a custom ...


3

jss create command by default pulls application template from master branch from JSS github repo (which contains the latest version). To override this behaviour you can use jss create -b or jss create -s switch: -b is to select application template from specific branch from JSS github repo, -s is to use local folder with JSS application template (which you ...


3

In vanilla JavaScript, the convention is to use camelCase for field names, and PascalCase for class names. In React, the convention is to use PascalCase only for component names. So to answer your question, I'd recommend camelCase for the actual field names, and utilizing display names for the Content Author's readability sake.


3

You can use the below function to query a defined GraphQL endpoint. function Invoke-GraphRequest { param( [string]$query, [Sitecore.Data.Items.Item]$siteRoot, [string]$apiPath ) $apiKeyItemPath = "/sitecore/system/Settings/Services/API Keys/key-name" $apiKeyItem = Get-Item -Path "master:$...


3

Once you get a Component from the Placeholder, you can use the ReadFields<T>() method or other Read methods to get strongly-typed values from it. Keep in mind that this is just JSON deserialization, the ASP.NET model binding attributes won't work here.


3

To fix the issue you need to implement React component for this rendering. The problem is that layout service returns it with space in name, so your componentFactory.js should have following generated output to register such component: import HiddenRendering from '../helpers/HiddenRendering'; components.set('Hidden Rendering', HiddenRendering); To achieve ...


2

I will try to answer to @Jeeby's questions: did you go with SXA?--->No (it may be possible but we haven't use it) How did it work out for you? ---> We ended up with a single JSS App and 3 sites under /sitecore/content with common components outside of them under one Universal folder. Sitecore Support helped us with sharing components between sites, ...


2

Looks like you have missed to follow the post-installation instructions of JSS. Make sure you add the following to your web.config (system.webServer/handlers section): <add verb="*" path="sitecorejss_media.ashx" type="Sitecore.JavaScriptServices.Media.MediaRequestHandler, Sitecore.JavaScriptServices.Media" name="Sitecore....


2

I have implemented a video component without using any react plugin. It supports both Youtube and Vimeo. The code snippet is very small. Please see below <iframe width="100%" height="345" title="event-video" src={videoUrl} /> Here I retrieve the videoUrl from Sitecore Item which should be of the embedding type. You can also retrieve the ...


2

Following some testing locally, the reason you may be getting an Error 404 is when there is no layout set on the item. So, my test cases were as follows: 1st Test Case Create an template without any additional fields. Create an item based on my newly created template. Access the layout service api. Outcome: Error 404 2nd Test Case Create an template ...


2

The following steps helped me to resolve the same issue: Added C:\Program Files\nodejs\ to PATH environment variable (for User) Added full permissions for the App Pool user (in my case default IIS_IUSRS) for this folder - C:\Program Files\nodejs Bounced IIS


2

This error occurs when the Renderings defined in Sitecore and the components defined in the JSS app do not match. Rishi - You said you deployed using jss deploy files - this command deploys the JS bundle, but does not create any Sitecore items. When switching from Code-First to Sitecore-First, it is recommended to use jss deploy app to ensure that files, and ...


2

Solved by adding sc_site: config.jssAppName to the RouteHandler.js query string parameters. Edit RouteHandler.js: ... function getRouteData(route, language) { const fetchOptions = { layoutServiceConfig: { host: config.sitecoreApiHost }, querystringParams: { sc_lang: language, sc_apikey: config.sitecoreApiKey, sc_site: config.jssAppName }, ...


2

Based on recent development on Sitecore JSS with Multisite, if each site has its own JSS App, then your setup will be as follows: What will be the value for "layoutServiceHost" and "deployUrl" since we will be using same sitecore instance for both the apps Site A layoutServiceHost": "https://abc-single-azurewebsites.net" ...


2

Sitecore JSS 15 is not compatible with Sitecore 9.1. You can use, Sitecore JSS 15 with Sitecore 10 or you can use Sitecore JSS 11 with Sitecore 9.1. You can check the complete compatible table here. https://kb.sitecore.net/articles/541788


2

Another solution would be to add support for environment variables in your JSS bundle. It was added already for Next.js: https://github.com/Sitecore/jss/pull/527/files but it works also for React with one difference in generate-config.js: instead of const computedConfig: { [key: string]: string } = {}; use just const computedConfig = {}; rest of the changes ...


2

We have discussed the issue in a private chat and figured out, that the /CustomHome item are placed on the same level with a site start item which makes it impossible to resolved by relative path. In general, Layout Service item resolving process looks similar with an original item resolving: 1) Sitecore sites are resolved based on hostname or sc_site query ...


2

We had similar requirement to distinguish whether page is secured or not. Based on that we are then checking whether user is authenticated or not. Implementation is using React but I think for Angular it will be similar in your case. We have added new field of type checkbox "securedRoute" to /sitecore/definitions/route.sitecore.js: In the route ...


1

Root cause: the content wasn't available in the locale specified by URL: en-US. The docs, https://jss.sitecore.com/docs/getting-started/app-deployment, will create content in en. There will be an en.yml file in the [app]\data\routes folder. To create content in en-US, refer to https://jss.sitecore.com/docs/techniques/content-translation. Copy en.yml as en-...


1

There are two types of Item resolver in JSS: First and which you already implemented: public class ResolveItem : HttpRequestProcessor { public override void Process(HttpRequestArgs args) { var item = ANY YOUR LOGIC TO GET 404 item. Context.Item = item; } } <configuration xmlns:patch="http://...


1

I would suggest not to modify your UI source code for this implementation but you can simply implement it from the node js proxy. Define config.js for each site. Use node vhost package to select appropriate config based on hostname.


1

No, that is not possible. The whole logic (scopes, boosting, ...) can be used only by SXA search renderings at the moment.


1

You have to use the jss field and then it starts working: <Image field={image.jss} height="245" width="400" imageParams={{ w: 400, h: 245 }} />


1

TL;DR I think you forgot to extend Page template with appropriate field (_Sitemap) Current status Right now SXA (10 and lower) doesn't support officially Sitemap feature in JSS sites. There is no feature parity between SXA and JSS. Both are technically separate types of sites which have different set of scaffolding actions. You can compare what modules/...


1

When you open Experience Editor or try to open the page, Sitecore tries to find a jss app with the same name as a context site. As far as I see, the site has the "app" name. I suppose your JSS app has different name. You need to synchronize your jss app and site names.


1

Are you planning multiple jss app for multiple sites or single jss app for multiple sites? First scenario, take different builds and keep it in different folders in the proxy server. Then define same number of config (config.js). Install vhost (npm install vhost) in the proxy server , which can be used to conditionally take config to be executed based on the ...


1

The jss create command simply clones one of these starter projects from the public jss repo. So errors when running this command are usually caused by GitHub being blocked due to a security policy. If adding the Sitecore JSS repo to list of permitted access points is not an option with your company, you have the following options: When you run jss create [...


1

You appear to have an inconsistent JSS installation. Ensure all Sitecore.JavaScriptServices assemblies are of the same version. If you are referencing JSS assemblies via NuGet, ensure you are referencing the correct version and not deploying the wrong version into your solution.


Only top voted, non community-wiki answers of a minimum length are eligible