From 39ba212e626e9a5d5bd5898996c96261e79add09 Mon Sep 17 00:00:00 2001 From: Daniel Wagner-Hall Date: Fri, 27 Dec 2024 00:06:30 +0000 Subject: [PATCH] Use $URL not $DEPLOY_PRIME_URL for prod deploys $DEPLOY_PRIME_URL appears to point at a .netlify.app version of the site, rather than the URL it's actually getting deployed as for prod deploys. But is needed for preview deploys. --- tooling/common-config/deploy-netlify.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tooling/common-config/deploy-netlify.sh b/tooling/common-config/deploy-netlify.sh index ccfc25a77..526e67a46 100755 --- a/tooling/common-config/deploy-netlify.sh +++ b/tooling/common-config/deploy-netlify.sh @@ -4,5 +4,10 @@ set -euo pipefail npm install --legacy-peer-deps +URL_TO_USE="${URL}" +if [[ "${PULL_REQUEST}" == "true" ]]; then + URL_TO_USE="${DEPLOY_PRIME_URL}" +fi + # We set --baseURL on netlify so that any references to .Permalink end up pointing at deploy preview pages, rather than being hard-coded to point at the production URLs. -hugo --minify --environment production --baseURL $DEPLOY_PRIME_URL && npx pagefind --site "public" +hugo --minify --environment production --baseURL "${URL_TO_USE}" && npx pagefind --site "public"