From 127a3178f0da99411a24951cd77848f61aecb36f Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 1 Aug 2023 14:52:49 -0400 Subject: [PATCH 1/3] fix: sitemap url for production deployments https://twitter.com/mayankistyping/status/1686288768326914048 Signed-off-by: Steven --- next.constants.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/next.constants.mjs b/next.constants.mjs index a701886ad77c3..8fdb93b141da4 100644 --- a/next.constants.mjs +++ b/next.constants.mjs @@ -32,7 +32,9 @@ export const ENABLE_STATIC_EXPORT = * * @see https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#framework-environment-variables */ -export const BASE_URL = process.env.NEXT_PUBLIC_VERCEL_URL +export const BASE_URL = process.env.VERCEL_ENV === 'production' + ? 'https://nodejs.org' + : process.env.NEXT_PUBLIC_VERCEL_URL ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` : process.env.NEXT_PUBLIC_BASE_URL || 'https://nodejs.org'; From 0c78791d0dae54d7dc07610c2bc239fb42c86c33 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 1 Aug 2023 15:02:27 -0400 Subject: [PATCH 2/3] chore: prettier --- next.constants.mjs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/next.constants.mjs b/next.constants.mjs index 8fdb93b141da4..c970e784cf189 100644 --- a/next.constants.mjs +++ b/next.constants.mjs @@ -32,11 +32,12 @@ export const ENABLE_STATIC_EXPORT = * * @see https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#framework-environment-variables */ -export const BASE_URL = process.env.VERCEL_ENV === 'production' - ? 'https://nodejs.org' - : process.env.NEXT_PUBLIC_VERCEL_URL - ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` - : process.env.NEXT_PUBLIC_BASE_URL || 'https://nodejs.org'; +export const BASE_URL = + process.env.VERCEL_ENV === 'production' + ? 'https://nodejs.org' + : process.env.NEXT_PUBLIC_VERCEL_URL + ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` + : process.env.NEXT_PUBLIC_BASE_URL || 'https://nodejs.org'; /** * This is used for any place that requires the Node.js distribution URL (which by default is nodejs.org/dist) From da7cb21488f6dd6ae34fb0c5b20691f9130089a8 Mon Sep 17 00:00:00 2001 From: Steven Date: Tue, 1 Aug 2023 18:15:43 -0400 Subject: [PATCH 3/3] fix: prefer `NEXT_PUBLIC_BASE_URL` --- next.constants.mjs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/next.constants.mjs b/next.constants.mjs index c970e784cf189..e9d70871e2609 100644 --- a/next.constants.mjs +++ b/next.constants.mjs @@ -32,12 +32,11 @@ export const ENABLE_STATIC_EXPORT = * * @see https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#framework-environment-variables */ -export const BASE_URL = - process.env.VERCEL_ENV === 'production' - ? 'https://nodejs.org' - : process.env.NEXT_PUBLIC_VERCEL_URL - ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` - : process.env.NEXT_PUBLIC_BASE_URL || 'https://nodejs.org'; +export const BASE_URL = process.env.NEXT_PUBLIC_BASE_URL + ? process.env.NEXT_PUBLIC_BASE_URL + : process.env.NEXT_PUBLIC_VERCEL_URL + ? `https://${process.env.NEXT_PUBLIC_VERCEL_URL}` + : 'https://nodejs.org'; /** * This is used for any place that requires the Node.js distribution URL (which by default is nodejs.org/dist)