Skip to content
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
43 changes: 43 additions & 0 deletions apps/web/src/app/(home)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,51 @@
import Link from 'next/link';
import type { Metadata } from 'next';
import { CodeBlock } from '@/components/code-block';
import { CtaCard } from '@/components/cta-card';
import { Footer } from '@/components/footer';

export const metadata: Metadata = {
title: '@deessejs/errors — Error Handling, Reimagined',
description:
'@deessejs/errors is a TypeScript library bringing Python-inspired error handling to JavaScript. Exception chaining, hierarchical inheritance, message templates, and rich error semantics through a function-based API.',
keywords: [
'typescript error handling',
'exception chaining typescript',
'python-style errors javascript',
'error factory typescript',
'structured errors typescript',
'hierarchical error inheritance',
],
openGraph: {
type: 'website',
locale: 'en_US',
url: 'https://errors.deessejs.com',
siteName: '@deessejs/errors',
title: '@deessejs/errors — Error Handling, Reimagined',
description:
'A TypeScript library bringing Python-inspired error handling to JavaScript. Exception chaining, hierarchical inheritance, and rich error semantics.',
images: [
{
url: 'https://errors.deessejs.com/og/home.png',
width: 1200,
height: 630,
alt: '@deessejs/errors — TypeScript Error Handling Library',
},
],
},
twitter: {
card: 'summary_large_image',
title: '@deessejs/errors — Error Handling, Reimagined',
description:
'A TypeScript library bringing Python-inspired error handling to JavaScript.',
images: ['https://errors.deessejs.com/og/home.png'],
creator: '@nesalia_inc',
},
alternates: {
canonical: 'https://errors.deessejs.com',
},
};

// Floating squares data for blueprint aesthetic
const floatingSquares = [
{ x: 300, y: 120, opacity: 1.0, delay: 0.7 },
Expand Down
5 changes: 4 additions & 1 deletion apps/web/src/app/docs/[[...slug]]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { notFound } from 'next/navigation';
import { getMDXComponents } from '@/components/mdx';
import type { Metadata } from 'next';
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { gitConfig } from '@/lib/shared';
import { gitConfig, siteUrl } from '@/lib/shared';

export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
const params = await props.params;
Expand Down Expand Up @@ -56,6 +56,9 @@ export async function generateMetadata(props: PageProps<'/docs/[[...slug]]'>): P
return {
title: page.data.title,
description: page.data.description,
alternates: {
canonical: `${siteUrl}${page.url}`,
},
openGraph: {
images: getPageImage(page).url,
},
Expand Down
3 changes: 3 additions & 0 deletions apps/web/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const inter = Inter({
export default function Layout({ children }: LayoutProps<'/'>) {
return (
<html lang="en" className={inter.className} suppressHydrationWarning>
<head>
<link rel="sitemap" type="application/xml" href="/sitemap.xml" />
</head>
<body className="flex flex-col min-h-screen">
<RootProvider>{children}</RootProvider>
<Analytics />
Expand Down
12 changes: 10 additions & 2 deletions apps/web/src/app/og/docs/[...slug]/route.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@ export const revalidate = false;

export async function GET(_req: Request, { params }: RouteContext<'/og/docs/[...slug]'>) {
const { slug } = await params;
const page = source.getPage(slug.slice(0, -1));

// getPageImage() appends 'image.png' to the slug array.
// Strip it to get back the real page slugs.
// Defensive: only strip if the last segment is exactly 'image.png'.
const cleanSlug =
slug.length > 1 && slug[slug.length - 1] === 'image.png'
? slug.slice(0, -1)
: slug;

const page = source.getPage(cleanSlug);
if (!page) notFound();

return new ImageResponse(
Expand All @@ -22,7 +31,6 @@ export async function GET(_req: Request, { params }: RouteContext<'/og/docs/[...

export function generateStaticParams() {
return source.getPages().map((page) => ({
lang: page.locale,
slug: getPageImage(page).segments,
}));
}
19 changes: 19 additions & 0 deletions apps/web/src/app/og/home/route.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { ImageResponse } from 'next/og';
import { generate as DefaultImage } from 'fumadocs-ui/og';
import { appName } from '@/lib/shared';

export const revalidate = false;

export async function GET() {
return new ImageResponse(
<DefaultImage
title="Error Handling, Reimagined."
description="A TypeScript library bringing Python-inspired error handling to JavaScript. Exception chaining, hierarchical inheritance, and rich error semantics."
site={appName}
/>,
{
width: 1200,
height: 630,
},
);
}
14 changes: 14 additions & 0 deletions apps/web/src/app/robots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { MetadataRoute } from 'next';

export default function robots(): MetadataRoute.Robots {
return {
rules: [
{
userAgent: '*',
allow: '/',
disallow: ['/api/search', '/llms.mdx'],
},
],
sitemap: 'https://errors.deessejs.com/sitemap.xml',
};
}
27 changes: 27 additions & 0 deletions apps/web/src/app/sitemap.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { MetadataRoute } from 'next';
import { source } from '@/lib/source';
import { siteUrl } from '@/lib/shared';
import { getPageImage } from '@/lib/source';

export default function sitemap(): MetadataRoute.Sitemap {
const pages = source.getPages();

const docPages = pages.map((page) => ({
url: `${siteUrl}${page.url}`,
lastModified: new Date(),
changeFrequency: 'weekly' as const,
priority: page.url === '/docs' ? 1.0 : 0.8,
images: [`${siteUrl}${getPageImage(page).url}`],
}));

const staticPages: MetadataRoute.Sitemap = [
{
url: siteUrl,
lastModified: new Date(),
changeFrequency: 'monthly',
priority: 0.9,
},
];

return [...staticPages, ...docPages];
}
1 change: 1 addition & 0 deletions apps/web/src/lib/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const appName = 'DeesseJS Errors';
export const docsRoute = '/docs';
export const docsImageRoute = '/og/docs';
export const docsContentRoute = '/llms.mdx/docs';
export const siteUrl = 'https://errors.deessejs.com';

export const gitConfig = {
user: 'nesalia-inc',
Expand Down
Loading