-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Gkrumbach07/fix-redirect
fix redirect in docs
- Loading branch information
Showing
2 changed files
with
15 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |