Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ lastUpdated: '2024-01-11'
"deployItems": ["*.module.json"],
"renderingHosts": {
"xmcloudpreview": {
"path": "./src/sxastarter",
"path": "./headapps/nextjs-starter",
"nodeVersion": "16.15.1",
"jssDeploymentSecret": "110F1C44A496B45478640DD36F80C18C9",
"enabled": true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ This will pull the repository into the Codespace ready to run. Before running, t

To run the web application, first the developer needs to configure the environment variables for the solution.

In Codespaces (or VS Code), navigate to the folder containing your Next.js application. In the starter kit, this is located at `./src/sxastarter`.
In Codespaces (or VS Code), navigate to the folder containing your Next.js application. In the starter kit, this is located at `./headapps/nextjs-starter`.

Add an `.env.local` file and populate the following environment variables with the values from your XM Cloud instance (do not commit these changes back to the repository):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,13 @@ This will increase overall build time but can reduce the amount of concurrent re

To reduce the number of requests to Experience Edge, you can tune the web application cache in the following areas:

- [Dictionary service](https://github.com/sitecorelabs/xmcloud-foundation-head/blob/main/src/sxastarter/src/lib/dictionary-service-factory.ts#L20)
- [Dictionary service](https://github.com/sitecorelabs/xmcloud-foundation-head/blob/main/headapps/nextjs-starter/src/lib/dictionary-service-factory.ts#L20)
- The default `cacheTimeout` is 60 seconds, you can increase this to reduce the number of requests to Experience Edge.
- Increase `pageSize` (10 default) - this value can go up to 1000 depending on how many dictionary items you have
- [Personalize middleware](https://github.com/sitecorelabs/xmcloud-foundation-head/blob/main/src/sxastarter/src/lib/middleware/plugins/personalize.ts#L26)
- [Personalize middleware](https://github.com/sitecorelabs/xmcloud-foundation-head/blob/main/headapps/nextjs-starter/src/lib/middleware/plugins/personalize.ts#L24)
- Increase the default `cacheTimeout` (10s default)
- If your client is not using Embedded Personalization, disable or remove the middleware
- [Redirects middleware](https://github.com/sitecorelabs/xmcloud-foundation-head/blob/main/src/sxastarter/src/lib/middleware/plugins/redirects.ts#L12)
- [Redirects middleware](https://github.com/sitecorelabs/xmcloud-foundation-head/blob/main/headapps/nextjs-starter/src/lib/middleware/plugins/redirects.ts#L12)
- Increase the default `cacheTimeout` (10s default)
- If you are not using (SXA) redirects, you can disable or remove the middleware

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ The init script initializes the `.env` file with everything necessary.

As you may remember from the introduction in the previous tutorial, you need to use a [GraphQL endpoint](https://doc.sitecore.com/xmc/en/developers/jss/latest/jss-xmc/jss-graphql-api.html) to query the content coming from XM Cloud. To connect to the endpoint, a few things need to be configured up front.

1. Navigate to the `.env` file within your solution under src\sxastarter, and copy it.
1. Navigate to the `.env` file within your solution under headapps\nextjs-starter, and copy it.

1. Name it `.env.local`. We do this so that the file is ignored by git by default, so that you do not pass valuable configuration secrets into any repositories.

Expand All @@ -128,7 +128,7 @@ Now, you need to set the API key within `.env.local`. The API key should be alre
<Image title="Copy Context ID into .env file" src="/images/getting-started/tutorials/xm-cloud/create-a-site-12.png" maxW="xl" />
1. Add the Site name (e.g. `Company dev`) to the `SITECORE_SITE_NAME` environment variable in the `.env.local` file.
<Image title="Set Site name in .env file" src="/images/getting-started/tutorials/xm-cloud/create-a-site-13.png" maxW="xl" />
1. In your terminal navigate to src/sxastarter (your app folder) and run `npm install`
1. In your terminal navigate to headapps/nextjs-starter (your app folder) and run `npm install`
<Image title="In Command Line Interface - Run npm install" src="/images/getting-started/tutorials/xm-cloud/create-a-site-14.png" maxW="xl" />
1. Now run `npm run start:connected`
<Image title="Start the app locally" src="/images/getting-started/tutorials/xm-cloud/create-a-site-15.png" maxW="xl" />
Expand Down