- Upgrade guides
Upgrade Content SDK 0.1.0 Angular apps to version 1.0.0
This guide covers the required changes you must make to your existing Content SDK 0.1.0 Angular applications to take advantage of the new features and improvements in version 1.0.0. Content SDK for Angular 1.0.0 adds an experimental features endpoint, bot tracking, and redirects middleware to the generated Express SSR host, and exports the request handler by default from server.ts.
Because Angular development is very flexible and customizable, this guide provides only general instructions and might not cover the specific configurations, custom code, or architectural decisions present in your existing application.
-
If you have a JSS app that you want to convert into a Content SDK app, follow the migration guide to upgrade your JSS 22.x Angular app to Content SDK 1.0 instead of this topic.
-
Review the changelog for the
@sitecore-content-sdk/angularpackage. If your application is heavily customized, the changelog can provide guidance on what additional changes you need that are not covered in this topic.
This topic describes how to:
Update application dependencies in your existing app
For your upgraded application to work correctly, you must update dependencies.
To update your dependencies:
-
In your existing application's
package.jsonfile, update every@sitecore-content-sdkpackage to version1.0.0. -
Install the dependencies with the following command:
Update the server.ts file in your existing app
After updating your dependencies, you must synchronize the Express SSR host in your existing application, src/server.ts, so it registers the new middleware introduced in version 1.0.0.
To update src/server.ts:
-
Add the following imports to the existing
@sitecore-content-sdk/angularimport: -
Register the new middleware in the correct order. The order in which middleware is registered determines its execution order, so add each of the following in the position described:
-
Add
createExperimentalFeaturesMiddlewarebetweencreateEditingConfigMiddlewareandcreateEditingRenderMiddleware: -
Add
createBotTrackingMiddlewareandcreateRedirectsMiddlewareaftercreateMultisiteMiddleware:
NoteMiddleware definition order is important, as it determines the order the middleware is executed in at request time.
-
-
Add a default export at the end of the file, after the existing
reqHandlerexport insrc/server.ts: -
Replace the SITE_NAME and LANGUAGE env variables with new names:
- Replace
CSDK_PUBLIC_SITECORE_DEFAULT_SITEwithCSDK_PUBLIC_DEFAULT_SITE_NAME - Replace
CSDK_PUBLIC_SITECORE_DEFAULT_LANGUAGEwithCSDK_PUBLIC_DEFAULT_LANGUAGE - Preserve values for both, only the names are changed.
- Replace
Next steps
To finalize the upgrade process, make sure you resolve any errors and warnings you encounter. Enable debug logging for Content SDK specific issues to assist you if necessary.