Skip to content
This repository has been archived by the owner on Jan 8, 2025. It is now read-only.

Improve 404 error page, logging #501

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 55 additions & 7 deletions pages/404.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,63 @@
// 404.js

import Link from "next/link";
import { sendPageNotFoundError } from "utils/posthog";
import { useEffect } from "react";
import SiteHeader from "components/Header";
import Footer from "layouts/DocsPage/Footer";

export default function FourOhFour() {
useEffect(() => {
void sendPageNotFoundError(); // Report Error to PostHog for tracking
}, []);

return (
<>
<title>404 | Teleport</title>
<h1>404 - Page Not Found</h1>
We&apos;re very sorry - we could not find the page you were looking for.
Please navigate to the Teleport <Link href="/">Documentation</Link> or the
&nbsp;<a href="/">Home Page</a> to find what you&apos;re looking for.
</>
<div>
<SiteHeader />
<div style={{ padding: "50px" }}>
<h1>404 Page Not Found</h1>
<p>Sorry, we couldn&apos;t find that page!</p>
<p>
Go back to Documentation <Link href="/">home</Link>?
</p>
<h2>Other pages you may find useful</h2>
<ul style={{ marginLeft: 1 }}>
<li>
<a href="https://goteleport.com/">Home Page</a>
</li>
<li>
<Link href="https://goteleport.com/about/">About Us</Link>
</li>
<li>
<Link href="https://goteleport.com/blog/">Blog</Link>
</li>
<li>
<Link href="/support/">Customer Support</Link>
</li>
<li>
<Link href="/">Documentation Home</Link>
</li>
<li>
<Link href="installation">Installation</Link>
</li>
<li>
<Link href="server-access">Teleport Server Access</Link>
</li>
<li>
<Link href="kubernetes-access">Teleport Kubernetes Access</Link>
</li>
<li>
<Link href="database-access">Teleport Database Access</Link>
</li>
<li>
<Link href="desktop-access">Teleport Desktop Access</Link>
</li>
<li>
<Link href="application-access">Teleport Application Access</Link>
</li>
</ul>
</div>
<Footer section={true}></Footer>
</div>
);
}
5 changes: 5 additions & 0 deletions utils/posthog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export const sendPageview = async () => {
ph?.capture("$pageview");
};

export const sendPageNotFoundError = async () => {
const ph = await posthog();
ph?.capture("web.errors.pageNotFound");
};

export const sendDocsFeedback = async (rating: string, comment: string) => {
const ph = await posthog();

Expand Down
Loading