Skip to content

Commit

Permalink
fix: fixed build issue with redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Bobinstein committed Sep 5, 2024
1 parent 6803541 commit 6dc81a1
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions docs/src/.vuepress/enhanceApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ export default ({
// Normalize the path by removing any trailing slash for easier matching
const normalizedPath = to.path.replace(/\/$/, '');

// Check if we are on the staging site hosted on GitHub Pages
const isStaging = window.location.hostname === 'ar-io.github.io';

// Adjust the redirect paths based on the base URL
let redirectPath = redirects[normalizedPath];
if (redirectPath && isStaging) {
// Prepend '/docs' to the redirect path for the GitHub Pages base
redirectPath = `/docs${redirectPath}`;

// Only check for the staging environment in the browser
if (typeof window !== 'undefined') {
const isStaging = window.location.hostname === 'ar-io.github.io';

// Adjust the redirect paths based on the base URL for staging
if (redirectPath && isStaging) {
redirectPath = `/docs${redirectPath}`;
}
}

if (redirectPath) {
Expand Down

0 comments on commit 6dc81a1

Please sign in to comment.