Skip to content

Commit be253be

Browse files
Ajay-singh1craigbox
authored andcommitted
Fix: Site BaseURLs (#16568)
* Fix: Site baseURLs * Remove reduntant whitespace * Add Craig`s suggestion Co-authored by: Craig Box <[email protected]> * Update netlify.toml * Update netlify.toml * Test : Deploy-Preview * Fix: Makefile error * Decide the baseURL depending on the context * Update Makefile.core.mk * Apply suggestions from code review --------- Co-authored-by: Craig Box <[email protected]>
1 parent c5abb8b commit be253be

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Makefile.core.mk

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,19 @@ JUNIT_REPORT := $(shell which go-junit-report 2> /dev/null || echo "${ISTIO_BIN}
7272
ISTIO_SERVE_DOMAIN ?= localhost
7373
export ISTIO_SERVE_DOMAIN
7474

75+
# Determine the base URL for the Netlify-hosted site depending on the Hugo context.
76+
# 'production' context: Use site URL (istio.io, preliminary.istio.io or istio-staging.netlify.app)
77+
# 'deploy-preview' context: Use per-build URL (deploy-preview-16568--preliminary-istio.netlify.app)
78+
# any other context: use relative URLs
7579
ifeq ($(CONTEXT),production)
76-
baseurl := "$(URL)"
80+
NETLIFY_URL := $(URL)/latest
81+
else ifeq ($(CONTEXT),deploy-preview)
82+
NETLIFY_URL := $(DEPLOY_PRIME_URL)/latest
83+
else
84+
NETLIFY_URL := /latest
7785
endif
86+
export NETLIFY_URL
87+
7888

7989
# Which branch of the Istio source code do we fetch stuff from
8090
export SOURCE_BRANCH_NAME ?= master
@@ -146,7 +156,7 @@ netlify_install:
146156

147157
netlify: netlify_install
148158
@scripts/gen_site.sh
149-
@scripts/build_site.sh "/latest"
159+
@scripts/build_site.sh "${NETLIFY_URL}"
150160
@scripts/include_archive_site.sh
151161

152162
# ISTIO_API_GIT_SOURCE allows to override the default Istio API repository, https://github.com/istio/api@$(SOURCE_BRANCH_NAME)

netlify.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121

2222
[[edge_functions]]
2323
path = "/v*"
24-
function = "redirect-to-latest"
24+
function = "redirect-to-latest"

0 commit comments

Comments
 (0)