feat: let not-found page work with locale

This commit is contained in:
JiPai
2024-09-05 20:19:10 +08:00
parent 458ddc6e0a
commit d3108ebf65
7 changed files with 199 additions and 119 deletions

View File

@@ -0,0 +1,5 @@
import { notFound } from 'next/navigation'
export default function CatchAll() {
notFound()
}

View File

@@ -0,0 +1,101 @@
import clsx from 'clsx'
import { Inter, Lexend } from 'next/font/google'
import '@/styles/tailwind.css'
import GoogleAnalytics from '@/components/analitycs/google'
import { NextIntlClientProvider } from 'next-intl'
import { getMessages } from 'next-intl/server'
import type { Metadata } from 'next'
export const metadata: Metadata = {
title: {
default: 'Dokploy - Effortless Deployment Solutions',
template: '%s | Simplify Your DevOps',
},
alternates: {
canonical: 'https://dokploy.com',
languages: {
en: 'https://dokploy.com',
},
},
description:
'Streamline your deployment process with Dokploy. Effortlessly manage applications and databases on any VPS using Docker and Traefik for improved performance and security.',
applicationName: 'Dokploy',
keywords: [
'Dokploy',
'Docker',
'Traefik',
'deployment',
'VPS',
'application management',
'database management',
'DevOps',
'cloud infrastructure',
'UI Self hosted',
],
referrer: 'origin',
robots: 'index, follow',
openGraph: {
type: 'website',
url: 'https://dokploy.com',
title: 'Dokploy - Effortless Deployment Solutions',
description:
'Simplify your DevOps with Dokploy. Deploy applications and manage databases efficiently on any VPS.',
siteName: 'Dokploy',
images: [
{
url: 'http://dokploy.com/og.png',
},
],
},
twitter: {
card: 'summary_large_image',
site: '@Dokploy',
creator: '@Dokploy',
title: 'Dokploy - Simplify Your DevOps',
description:
'Deploy applications and manage databases with ease using Dokploy. Learn how our platform can elevate your infrastructure management.',
images: 'https://dokploy.com/og.png',
},
}
const inter = Inter({
subsets: ['latin'],
display: 'swap',
variable: '--font-inter',
})
const lexend = Lexend({
subsets: ['latin'],
display: 'swap',
variable: '--font-lexend',
})
export default async function RootLayout({
children,
params,
}: {
children: React.ReactNode
params: { locale: string }
}) {
const { locale } = params
const messages = await getMessages()
return (
<html
lang={locale}
className={clsx(
'h-full scroll-smooth',
inter.variable,
lexend.variable,
)}
>
<GoogleAnalytics />
<body className="flex h-full flex-col">
<NextIntlClientProvider messages={messages}>
{children}
</NextIntlClientProvider>
</body>
</html>
)
}

View File

@@ -0,0 +1,27 @@
import Link from 'next/link'
import { SlimLayout } from '../../components/SlimLayout'
// import { Button } from "../components/Button";
import { Logo } from '../../components/shared/Logo'
export default function NotFound() {
return (
<SlimLayout>
<div className="flex">
<Link href="/" aria-label="Home">
<Logo className="h-10 w-auto" />
</Link>
</div>
<p className="mt-20 text-sm font-medium text-gray-700">404</p>
<h1 className="mt-3 text-lg font-semibold text-gray-900">
Page not found
</h1>
<p className="mt-3 text-sm text-gray-700">
Sorry, we couldnt find the page youre looking for.
</p>
{/* <Button href="/" className="mt-10">
Go back home
</Button> */}
</SlimLayout>
)
}