Skip to content

Commit e3cd271

Browse files
committed
feat: improve SEO
1 parent b4e6c16 commit e3cd271

2 files changed

Lines changed: 28 additions & 14 deletions

File tree

app/[...slug]/page.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,25 @@ export async function generateMetadata(props: {
302302
}
303303
if (!page) notFound();
304304

305+
const canonicalPath = page.url.replace(/^\/en(\/|$)/, '/');
306+
305307
return {
306308
title: page.data.title,
307309
description: page.data.description,
310+
alternates: {
311+
canonical: canonicalPath,
312+
},
313+
openGraph: {
314+
title: page.data.title,
315+
description: page.data.description,
316+
url: canonicalPath,
317+
siteName: 'Steel Docs',
318+
type: 'article',
319+
},
320+
twitter: {
321+
card: 'summary',
322+
title: page.data.title,
323+
description: page.data.description,
324+
},
308325
};
309326
}

app/layout.tsx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
import './global.css';
22
import { RootProvider } from 'fumadocs-ui/provider';
33
import { GeistMono } from 'geist/font/mono';
4+
import type { Metadata } from 'next';
45
import type { ReactNode } from 'react';
56
import { inter, jetBrainsMono } from '@/fonts';
67
import { KeyboardShortcutsProvider } from '@/hooks/use-keyboard-shortcuts';
78
import { QueryProvider } from '@/providers/query-provider';
89

10+
export const metadata: Metadata = {
11+
metadataBase: new URL('https://docs.steel.dev'),
12+
alternates: {
13+
types: {
14+
'text/plain': '/llms.txt',
15+
},
16+
},
17+
};
18+
919
export default function RootLayout({ children }: { children: ReactNode }) {
1020
return (
1121
<html
1222
lang="en"
1323
className={`dark ${inter.variable} ${jetBrainsMono.variable} ${GeistMono.variable}`}
1424
suppressHydrationWarning
1525
>
16-
<head>
17-
<link
18-
rel="alternate"
19-
type="text/markdown"
20-
href="/llms.txt"
21-
title="LLM Documentation Index"
22-
/>
23-
<link
24-
rel="alternate"
25-
type="text/markdown"
26-
href="/llms-full.txt"
27-
title="Full LLM Documentation"
28-
/>
29-
</head>
26+
<head />
3027
<body className="flex flex-col min-h-screen">
3128
<QueryProvider>
3229
<KeyboardShortcutsProvider>

0 commit comments

Comments
 (0)