Skip to content

Commit

Permalink
Merge branch 'main' into fix-redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Gkrumbach07 authored Oct 15, 2024
2 parents 46d8e30 + 801e50d commit f40010a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions gatsby-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ export const createPages: GatsbyNode["createPages"] = async ({
}) => {
const { createPage, createRedirect } = actions;


const docsResult = await graphql<QueryResult>(`
query docFiles {
allFile(filter: {sourceInstanceName: {eq: "docs"}}) {
Expand Down
28 changes: 14 additions & 14 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -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<PageProps> = () => {
return (
<main>
<h1>Page not found</h1>
<p>
<Link to="/">Go home</Link>
</p>
</main>
);
};
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 <div>Redirecting...</div>
}

export const Head: HeadFC = () => <title>Not found</title>;
export default NotFoundPage

0 comments on commit f40010a

Please sign in to comment.