In the previous post I talked about how to wire up Sitecore Pages to use your local Content SDK editing host. This post will describe how to switch it in your deployed XM Cloud environment.
If you created your XM Cloud project using the auto-generated repository, you got a clone of the XM Cloud starter kit. That project, currently, includes 2 head apps: Next.js and Angular. By default, when you deploy your project, the Next.js app is set up as the editing host. You’ve now brought in a Content SDK app and want to switch the editing host to that one. So, how do you do it?
Turns out, it’s actually pretty simple. In your project root, look for xmcloud.build.json
. Open that file, and add this to the renderingHosts
section:
"contentsdk": {
"path": "./headapps/nextjs-content-sdk",
"nodeVersion": "22.11.0",
"jssDeploymentSecret": "<your deployment secret>",
"enabled": true,
"type": "sxa",
"buildCommand": "build",
"runCommand": "next:start"
}
The path should be the path to the folder containing the Content SDK app. You’ll also want to set enabled
to true
, and set it to false
for the other rendering hosts (or just remove those other hosts from this file altogether).
Shout out to Dan Solovay for the assist on this one!