Skip to content

Commit

Permalink
feat: add custom 404 page & conditionally render analytics script
Browse files Browse the repository at this point in the history
  • Loading branch information
hendraaagil committed Dec 27, 2022
1 parent f82da60 commit 2d4882f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
12 changes: 12 additions & 0 deletions src/pages/404.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Link, PageContainer, PageHeader } from '@/components'

export default function NotFound() {
const title = '404'

return (
<PageContainer seoProps={{ title, noindex: true }}>
<PageHeader title="404 | Page not found!" />
<Link url="/">Back to Home</Link>
</PageContainer>
)
}
16 changes: 10 additions & 6 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
import { Html, Head, Main, NextScript } from 'next/document'
import Script from 'next/script'

export default function Document() {
return (
<Html lang="en">
<Head>
<meta charSet="UTF-8" />
<meta content="ie=edge" httpEquiv="X-UA-Compatible" />
<script
async
defer
data-website-id="d7044884-6f55-4a16-8344-9221c0e82832"
src="https://analytics.hendraaagil.dev/umami.js"
/>
{process.env.NODE_ENV === 'production' && (
<Script
async
defer
strategy="afterInteractive"
data-website-id="d7044884-6f55-4a16-8344-9221c0e82832"
src="https://analytics.hendraaagil.dev/umami.js"
/>
)}
</Head>
<body>
<Main />
Expand Down

1 comment on commit 2d4882f

@vercel
Copy link

@vercel vercel bot commented on 2d4882f Dec 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.