diff --git a/CHANGELOG.md b/CHANGELOG.md index a48e9ca132..887f6c4b13 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ Check the BYOC documentation for more info. ([#1568](https://github.com/Sitecore * `[templates/nextjs]` `[templates/react]` `[templates/vue]` `[templates/angular]` Introduce layout service REST configuration name environment variable ([#1543](https://github.com/Sitecore/jss/pull/1543)) * `[templates/nextjs]` `[sitecore-jss-nextjs]` Support for out-of-process editing data caches was added. Vercel KV or a custom Redis cache can be used to improve editing in Pages and Experience Editor when using Vercel deployment as editing/rendering host ([#1530](https://github.com/Sitecore/jss/pull/1530)) * `[sitecore-jss-react]` Built-in MissingComponent component can now accept "errorOverride" text in props - to be displayed in the yellow frame as a custom error message. ([#1568](https://github.com/Sitecore/jss/pull/1568)) +* `[sitecore-jss-nextjs]` Support for public URL resolution in Netlify ([#1585](https://github.com/Sitecore/jss/pull/1585)) * `[templates/nextjs]` `[sitecore-jss-nextjs]` Better error handling for component-level data fetching ([#1586](https://github.com/Sitecore/jss/pull/1586)) ### 🧹 Chores diff --git a/packages/sitecore-jss-nextjs/src/utils/utils.ts b/packages/sitecore-jss-nextjs/src/utils/utils.ts index 16529c3879..f35b2db531 100644 --- a/packages/sitecore-jss-nextjs/src/utils/utils.ts +++ b/packages/sitecore-jss-nextjs/src/utils/utils.ts @@ -7,8 +7,10 @@ import { isEditorActive, resetEditorChromes } from '@sitecore-jss/sitecore-jss/u * This is set to http://localhost:3000 by default. * VERCEL_URL is provided by Vercel in case if we are in Preview deployment (deployment based on the custom branch), * preview deployment has unique url, we don't know exact url. + * Similarly, DEPLOY_URL is provided by Netlify and would give us the deploy URL */ export const getPublicUrl = (): string => { + if (process.env.NETLIFY && process.env.DEPLOY_URL) return process.env.DEPLOY_URL; if (process.env.VERCEL_URL) return `https://${process.env.VERCEL_URL}`; let url = process.env.PUBLIC_URL;