Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

Commit abf89d7

Browse files
committed
Remove react from 404
1 parent 31cd551 commit abf89d7

2 files changed

Lines changed: 7 additions & 43 deletions

File tree

gatsby-node.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,3 @@ exports.onCreateWebpackConfig = ({ stage, loaders, actions }) => {
1414
})
1515
}
1616
}
17-
18-
exports.createPages = async ({ actions }) => {
19-
const { createRedirect } = actions
20-
21-
createRedirect({
22-
fromPath: `/docs/harmonics`,
23-
toPath: `https://openwaters.io/tides/harmonics`,
24-
isPermanent: true,
25-
redirectInBrowser: true
26-
})
27-
28-
createRedirect({
29-
fromPath: `/docs/database`,
30-
toPath: `https://openwaters.io/tides/database`,
31-
isPermanent: true,
32-
redirectInBrowser: true
33-
})
34-
35-
// Catch-all redirect for everything else
36-
createRedirect({
37-
fromPath: `/*`,
38-
toPath: `https://openwaters.io/tides/neaps`,
39-
isPermanent: true,
40-
redirectInBrowser: true
41-
})
42-
}

src/pages/404.js

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,20 @@
1-
import React, { useEffect } from 'react'
2-
31
const NotFoundPage = () => {
4-
useEffect(() => {
2+
if (typeof window !== 'undefined') {
53
const path = window.location.pathname
64
const redirectMap = {
75
'/': 'https://openwaters.io/tides/neaps',
86
'/docs/harmonics': 'https://openwaters.io/tides/harmonics',
97
'/docs/tide-prediction': 'https://openwaters.io/tides/neaps',
10-
'/docs/database': 'https://openwaters.io/tides/database',
8+
'/docs/database': 'https://openwaters.io/tides/database'
119
}
1210

13-
// Check if path matches any specific redirect
14-
if (redirectMap[path]) {
15-
window.location.href = redirectMap[path]
16-
} else {
17-
// Default redirect for all other paths
18-
window.location.href = 'https://openwaters.io'
11+
const target = redirectMap[path] || 'https://openwaters.io'
12+
if (typeof window !== 'undefined') {
13+
window.location.replace(target)
1914
}
20-
}, [])
15+
}
2116

22-
return (
23-
<div style={{ padding: '2rem', textAlign: 'center' }}>
24-
<h1>Redirecting...</h1>
25-
<p>If you are not redirected automatically, <a href="https://openwaters.io">click here</a>.</p>
26-
</div>
27-
)
17+
return null
2818
}
2919

3020
export default NotFoundPage

0 commit comments

Comments
 (0)