What's new in Content SDK 2.1
Content SDK 2.1 introduces improvements across Next.js integrations, lightweight events tracking, search, and preview security, along with important bug fixes and maintenance updates.
To update your existing Content SDK 2.0 application to 2.1:
-
In your existing application's
package.jsonfile, update every@sitecore-content-sdkpackage to version2.1.0. -
Install the dependencies with the following command:
Notable improvements and bug fixes
The following features, improvements, and bug fixes have been introduced in Content SDK 2.1. This is not an exhaustive list. Please review the Content SDK 2.1 changelog for a complete list of all changes.
Lightweight tracking and bot detection
See Lightweight tracking and bot detection for more information.
Upgrade to Next.js 16.2.0
Next.js has been upgraded from 16.1.1 to 16.2.0. See the Next.js 16.2 announcement for more information.
Authorize internal editing host preview requests using the PreviewProxy
PreviewProxyWhen using Sitecore Pages to preview a site, users could open a page and preview it using the direct preview link even without the permission to access it. To overcome this, a new PreviewProxy is introduced that authorizes preview requests from internal editing hosts.
Currently, this is only applicable to internal editing hosts deployed on SitecoreAI.
To use this:
In proxy.ts, import PreviewProxy and add it as the first proxy in defineProxy(...):
The PreviewProxy is purely additive. If you do not add it, behavior is unchanged. We recommend adding it if you serve preview requests from an internal editing host.
Access preview data via request headers
Content SDK apps using Next.js App Router deployed to Vercel displayed a 500 error page in preview when Draft Mode was enabled on statically generated routes. This occurred because the searchParams parameter was empty, leaving the route without preview data and causing the editing and preview flow to fail.
This is expected behaviour in Next.js. In Draft Mode, searchParams are intentionally not forwarded. The Next.js team has confirmed that searchParams should not be relied on within draftMode(), as preview data is designed to be passed through request headers instead.
The Content SDK now propagates editing preview data from the editing render route handler to the page through a dedicated request header and exposes a new helper to access it.
To use this:
-
In your catch‑all page, find instances of
searchParamsusage: -
Replace them with the new
client.getPreviewData(...)helper to read preview data fromheaders(). as shown:ImportantFor existing apps, preview data continues to be appended to
searchParams. This does not cause the app to break on environments wheresearchParamsstill flows through. This duplication will be removed in the next major release. We recommend migrating to theclient.getPreviewData(...)method ahead of that.