diff --git a/gatsby-node.ts b/gatsby-node.ts index fb72c80e1e..0c3aa92bbf 100644 --- a/gatsby-node.ts +++ b/gatsby-node.ts @@ -167,6 +167,7 @@ export const createPages: GatsbyNode["createPages"] = async ({ }) => { const { createPage, createRedirect } = actions; + const docsResult = await graphql(` query docFiles { allFile(filter: {sourceInstanceName: {eq: "docs"}}) { diff --git a/src/pages/404.tsx b/src/pages/404.tsx index a71787c9fe..16561a6eeb 100644 --- a/src/pages/404.tsx +++ b/src/pages/404.tsx @@ -1,17 +1,17 @@ -import { HeadFC, Link, PageProps } from "gatsby"; -import * as React from "react"; +import React, { useEffect } from "react" +import { navigate } from "gatsby" -const NotFoundPage: React.FC = () => { - return ( -
-

Page not found

-

- Go home -

-
- ); -}; +const NotFoundPage = () => { + useEffect(() => { + const path = window.location.pathname + if (path === "/docs" || path === "/docs/") { + navigate("/docs/getting-started-with-open-data-hub") + } else { + navigate("/") // or to any default 404 page + } + }, []) -export default NotFoundPage; + return
Redirecting...
+} -export const Head: HeadFC = () => Not found; +export default NotFoundPage