chore: add 404 page

This commit is contained in:
Zotov Ivan Yuryevich
2026-06-17 22:53:04 +03:00
parent f3409e5618
commit df4a48f124
2 changed files with 25 additions and 1 deletions

24
src/pages/404.astro Normal file
View File

@@ -0,0 +1,24 @@
---
import Layout from '../layouts/Layout.astro'
import '../styles/globals.css'
import { siteConfigQuery } from '../graphql-documents/site-config.gql.generated'
let siteTitle = ''
let siteDescription = ''
try {
const siteResult = await siteConfigQuery.execute()
siteTitle = siteResult.data?.siteConfig?.title ?? ''
siteDescription = siteResult.data?.siteConfig?.description ?? ''
} catch {
// CMS may be unavailable on error pages
}
---
<Layout title={siteTitle} description={siteDescription}>
<div class="min-h-screen grid content-center justify-items-center">
<div>404</div>
<div>Страница не найдена</div>
<a href="/" class="text-blue-600 hover:text-blue-700">На главную</a>
</div>
</Layout>

View File

@@ -54,7 +54,7 @@ if (categoryResult.errors?.length) {
const category = categoryResult.data?.categories?.find(c => c != null)
if (!category) {
throw new Error(`Category not found for slug: ${slug}`)
return new Response(null, { status: 404, statusText: 'Not Found' })
}
const title = category.title ?? undefined