We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41a0308 commit 2ba5a9cCopy full SHA for 2ba5a9c
gatsby-browser.js
@@ -0,0 +1,17 @@
1
+function checkRedirect(inPath) {
2
+ const path = inPath.replace(/\/+$/, "");
3
+ if (path === "/postgraphile" || path.startsWith("/postgraphile/")) {
4
+ const parts = path.split("/");
5
+ if (!parts[2]) {
6
+ window.location.replace(`https://postgraphile.org`);
7
+ } else {
8
+ if (parts[2] === "introduction") parts.length = 2;
9
+ parts.splice(2, 0, "4");
10
+ window.location.replace(`https://postgraphile.org${parts.join("/")}`);
11
+ }
12
13
+}
14
+
15
+exports.onRouteUpdate = ({ location, prevLocation }) => {
16
+ checkRedirect(location.pathname);
17
+};
0 commit comments