Skip to content

Commit

Permalink
make Github Pages the normal case and deployment to Cascade the excep…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
wbbaker committed Oct 15, 2024
1 parent 1cd2020 commit 495bc6e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export function isValidUrl(string) {
}
}

// Allow base_url to be different on Github Pages than when deployed elsewhere, for example to Cascade.
// GithubPages requires the base_url to be the repository name, while Cascade needs the page to
// Allow base_url to be different when deployed elsewhere than Github Pages — for example to a CMS.
// GithubPages requires the base_url to be the repository name, while a CMS may need the page to
// fit into its own directory structure.
export const getBaseUrl = (configuration = __APP_ENV__) => {
const baseUrl = configuration?.base_url || ''
const githubPagesBaseUrl = configuration?.github_pages_base_url || ''
const deployedBaseUrl = configuration?.deployed_base_url || ''
const isGithubPages = window.location.origin.indexOf('.github.io/') > 0
return isGithubPages ? githubPagesBaseUrl : baseUrl
return isGithubPages ? baseUrl : deployedBaseUrl
}

0 comments on commit 495bc6e

Please sign in to comment.