Skip to content

Commit 00c0eb5

Browse files
authored
Fix broken images in Cloudflare preview builds (#1244)
Moved from #1232 This change updates production.sh to call hugo differently in Cloudflare environments than otherwise. - In Cloudflare, the variable $CF_PAGES_URL tracks the base URL of a PR build or the production deploy and needs to be part of the hugo command. - Locally, this variable is not set so don't try to use it. To help with debugging, log the environment we are building in. ## Tests - [x] Local build works, image shows up correctly - [x] PR build works, image shows up correctly
1 parent 4ff4da8 commit 00c0eb5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

scripts/production.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,13 @@
33
# Build the English docs from this branch
44
hugo mod get -u
55
rm -rf public
6-
hugo
6+
if [ -n "$CF_PAGES_URL" ]; then
7+
echo "Building in Cloudflare"
8+
hugo -b $CF_PAGES_URL
9+
else
10+
echo "Building locally"
11+
hugo
12+
fi
713
rm public/sitemap.xml
814
mv public/en/sitemap.xml public/sitemap.xml
915
rm -rf public/ja

0 commit comments

Comments
 (0)